June 2017
Intermediate to advanced
400 pages
10h 32m
English
Go is typically very flexible in conversion between data. A type may inherit another type as follows:
type A int
Then, we can always cast back to the type we inherited as follows:
var a A = 1fmt.Println(int(a))
There are also convenience functions for converting between numbers with casting, between strings and other types using fmt.Sprint and with strconv, and between interfaces and types using reflection. This recipe will explore some of these basic conversions that will be used throughout the book.
Read now
Unlock full access