How to print the value of a key containing dots

前端 未结 4 1214
清歌不尽
清歌不尽 2021-02-12 09:39

I\'m trying to print the values of a map, whose keys have a dot (.) on it.

Example map:

type TemplateData struct {
    Data map[string] int
         


        
4条回答
  •  醉话见心
    2021-02-12 10:10

    I had a similar issue where my key names in secret vault had - and . in it for example

    test-key or test.key

    If solved it like this

        {{ with secret "secret/path/test"}}
           {{ range $k, $v := .Data }}
              {{ $k }}:{{ $v }}
              {{ end }}
        {{ end }}
    

    Hope this will help someone...

提交回复
热议问题