diff --git a/viper.go b/viper.go index 7027715..6d149f6 100644 --- a/viper.go +++ b/viper.go @@ -1743,7 +1743,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(v.GetString(key)) } cfg.WriteTo(f) }