Appendix: Go Data Types and Templates
- string: A string of text
- bool: a or
false
- float64: a 64-bit floating point value (there are also 8, 16, and 32 bitvarieties of this)
- a byte slice (), often used to hold (potentially) binary data
- a slice (indexed list) of one of the previous types
- a string-keyed map (
map[string]interface{}
) where the value is one of theprevious typesThere are many other types in Go, and sometimes you will have to convert betweenthem in your templates. The easiest way to debug an object’s type is to pass itthrough in a template, which will print the type. Also see thetypeOf
and functions.