type T struct {
val int `yaml:"with_underscore"`
}
func TestUnmarshal(t *testing.T) {
a := assert.New(t)
yamlExample := []byte(`a: 2
with_underscore: 1`)
viper.SetConfigType("yaml")
viper.ReadConfig(bytes.NewBuffer(yamlExample))
a.Equal(1, viper.GetInt("with_underscore"))
tmp := T{}
err := viper.Unmarshal(&tmp)
a.Nil(err)
a.Equal(1, tmp.val)
}
with_underscore
field didn't get unmarshaled into tmp
. is there anyway around this?
hi viper folks, is this intentional new behavior around isSet()
. isSet()
now returns true
as soon as I bind a flag to viper
, it used to remain false until some input (config, command line, ENV) set the value that was not the flag
default.
I've also commented on this spf13/viper#276 from November '16 and hoped others could provide details on #276 so we can determine if this is desired or a bug.