diff --git a/viper.go b/viper.go index 4bc6726ae..63d813299 100644 --- a/viper.go +++ b/viper.go @@ -1657,7 +1657,7 @@ func (v *Viper) marshalWriter(f afero.File, configType string) error { if sectionName == "default" { sectionName = "" } - cfg.Section(sectionName).Key(keyName).SetValue(Get(key).(string)) + cfg.Section(sectionName).Key(keyName).SetValue(v.Get(key).(string)) } cfg.WriteTo(f) }