Is there a neat way to delimit map keys only?

I can use delimit to delimit all the values of a map, but I can find something similar for keys rather than using range.

Here’s what I want to do:

{{ $dict := "key1" "value1" "key2" "value2" }}
{{/* Somehow get "key1 key2 key3" */}}

I think you’ll need to range:

{{ $dict := dict "key1" "value1" "key2" "value2" }}
{{ $s := slice }}
{{ range $k := $dict }}{{ $s = append $k $s }}{{ end }}
{{ delimit $s " " }}
1 Like