Top "Go-templates" questions

Go language supports built-in template functionality.

How can I conditionally set a variable in a Go template based on an expression which may cause an error if not wrapped with an if statement

Question How do I do something like this: {{ $use_ssl := (ne $.Env.CERT_NAME "") }} where $.Env.CERT_NAME may be …

ruby go-templates
How to pass dynamic arguments to a helm chart that runs a job

I'd like to allow our developers to pass dynamic arguments to a helm template (Kubernetes job). Currently my arguments in …

kubernetes kubernetes-helm go-templates
In Go templates, accessing parent/global pipeline within range

Is it possible, within a {{range pipeline}} T1 {{end}} action in the text/template package to access the pipelines value …

go go-templates
What kubectl command can I use to get events sorted by specific fields and print only specific details of events?

I need to print only specific fields of Kubernetes Events, sorted by a specific field. This is to help me …

kubernetes kubectl go-templates
Multiple files using template.ParseFiles in golang

For example.go, I have package main import "html/template" import "net/http" func handler(w http.ResponseWriter, r *http.…

go go-templates
Is there an efficient way to concatenate strings

For example, there is a function like that: func TestFunc(str string) string { return strings.Trim(str," ") } It runs in …

go concatenation go-templates
In a template how do you access an outer scope while inside of a "with" or "range" scope?

When inside a with or range, the scope of . is changed. How do you access the calling scope?

go go-templates
How to replace string in Go template?

I use "text/template" module. I have struct like this to parse XML from Blogger type Media struct { ThumbnailUrl string `…

go go-templates
kubectl apply error: error converting YAML to JSON

Getting this error message after kubectl apply -f . error: error converting YAML to JSON: yaml: invalid map key: map[interface {}]…

json kubernetes yaml kubernetes-helm go-templates
Iterate Go map get index

In order to use revel's even keyword in templates I would like to get the index of a map entry …

dictionary go go-templates revel