Update viper.go

This commit is contained in:
zhangyongding 2020-06-01 18:07:26 +08:00 committed by GitHub
parent 13df721090
commit 2bf315e378
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1649,7 +1649,7 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error {
if sectionName == "default" {
sectionName = ""
}
cfg.Section(sectionName).Key(keyName).SetValue(v.Get(key).(string))
cfg.Section(sectionName).Key(keyName).SetValue(cast.ToString(v.Get(key)))
}
cfg.WriteTo(f)
}