sprig icon indicating copy to clipboard operation
sprig copied to clipboard

FeatureRequest: serialize map

Open BrendanBall opened this issue 7 years ago • 0 comments
trafficstars

I have a use for needing to easily serialize a map[string]string given a sep and assign. I need it for a helm chart where I want to serialize a yaml map into an env var of the form key:value,key2:value which will then be auto deserialized into a map with https://github.com/kelseyhightower/envconfig.

Do you think others might find this useful? I want to add it here because helm uses this lib for utility functions in templates. If you're willing to add such a function here I'd be happy to create a PR.

I would make the implementation similar to the join (join: strings.Join, but as join SEP SLICE) function currently supported. something like joinMap SEP ASSIGN MAP and then joinMap "," ":" map[string][string]{"a":"b", "c", "d"} results in a:b,c:d

BrendanBall avatar Mar 05 '18 14:03 BrendanBall