Skip to content

Instantly share code, notes, and snippets.

@r6m
Last active June 9, 2018 15:12
Show Gist options
  • Save r6m/0aad1b710be898252fa0ca1c28cc42b5 to your computer and use it in GitHub Desktop.
Save r6m/0aad1b710be898252fa0ca1c28cc42b5 to your computer and use it in GitHub Desktop.
golang template using delimeter
{{$equipment := .Equipment}}
{{ range $index, $element := .Equipment}}
{{if $index}},{{end}}
{{$element.Name}}
{{end}}
// or if it's an array
// then register a function using template.Funcs(templte.FuncMap{"Join", strings.Join})
{{ Join .Array ", " }}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment