The empty function returns true if the given value is considered empty, and false otherwise. The empty values are listed in the default section.

empty .Foo

Note that in Go template conditionals, emptiness is calculated for you. Thus, you rarely need if empty .Foo. Instead, just use if .Foo.

Back to top