I am trying to use viper to set a particular property. I am aware of the convenience syntax that allows setting a viper configuration property by using the "dot" notation to reference nested properties.
viper.Set("something.else.list[0].property", "value")
However when I try to do the same for a property which contains a list of nested properties (as above), it does not work. It treats [0]
or [%d]
as string (which makes sense), and ends up creating "list[0]"
as a key under the else
key.
How can I set a particular element of the array using this convention?