Top "Go-templates" questions

Go language supports built-in template functionality.

How to index a slice element?

I have a slice: Keys []* datastore.Key How could I index one of them in the template file? I guessed {{.…

slice go-templates
Calling a template with several pipeline parameters

In a Go template, sometimes the way to pass the right data to the right template feels awkward to me. …

templates go go-templates
Call a method from a Go template

Let's say I have type Person struct { Name string } func (p *Person) Label() string { return "This is " + p.Name } How …

go go-templates
multiple conditions in if statement Go templates

how can I have multiple conditions in an if statement inside a template? I tried this code: {{ if .condition1 &&…

go go-templates
Arithmetic in Go templates

I am trying to achieve a very simple thing in a Go template and failing! The range action allows me …

go go-templates
how to check empty value of a string in golang template

I have this below golang template code snippet where I take values from a map of type map[string]interface{} …

string go go-templates
How do I escape “{{” and “}}” delimiters in Go templates?

I’m using AngularJS as the front-end JS library, with Go templates within Revel framework to to generate the markup …

go go-templates
Implement a for loop inside a Go template

I am working in Go, and right now I need to print at least 20 options inside a select, so I …

go-templates
Helm _helpers.tpl: Calling defined templates in other template definitions

Helm _helpers.tpl? Helm allows for the use of Go templating in resource files for Kubernetes. A file named _helpers.…

templates go kubernetes go-templates kubernetes-helm
Golang template variable isset

I have created a function to check if a variable is defined: fm["isset"] = func(a interface{}) bool { if a == …

if-statement go struct go-templates