diff --git a/viper.go b/viper.go index 907a102..651fdb3 100644 --- a/viper.go +++ b/viper.go @@ -1266,7 +1266,7 @@ func (v *Viper) writeConfig(filename string, force bool) error { if err != nil { return err } - return v.marshalWriter(f, configType) + return v.MarshalWriter(f, configType) } // Unmarshal a Reader into a map. @@ -1329,11 +1329,13 @@ func (v *Viper) unmarshalReader(in io.Reader, c map[string]interface{}) error { return nil } -// Marshal a map into Writer. -func marshalWriter(f afero.File, configType string) error { - return v.marshalWriter(f, configType) +// MarshalWriter will marshal a map into Writer for the default config +func MarshalWriter(f afero.File, configType string) error { + return v.MarshalWriter(f, configType) } -func (v *Viper) marshalWriter(f afero.File, configType string) error { + +// MarshalWriter will marshal a map into Writer. +func (v *Viper) MarshalWriter(f afero.File, configType string) error { c := v.AllSettings() switch configType { case "json":