Appendix: Go Data Types and Templates
The Helm template language is implemented in the strongly typed Go programminglanguage. For that reason, variables in templates are typed. For the mostpart, variables will be exposed as one of the following types:
- string: A string of text
- bool: a
true
orfalse
- int: An integer value (there are also 8, 16, 32, and 64 bit signed andunsigned variants of this)
- float64: a 64-bit floating point value (there are also 8, 16, and 32 bitvarieties of this)
- a byte slice (
[]byte
), often used to hold (potentially) binary data - struct: an object with properties and methods
- 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 itthroughprintf "%t"
in a template, which will print the type. Also see thetypeOf
andkindOf
functions.