From 2e2f3b26431fe06fe321136268380b898f3d855b Mon Sep 17 00:00:00 2001 From: Kiril Zvezdarov Date: Mon, 16 Feb 2015 23:42:08 -0500 Subject: [PATCH] Marshal now gets the map via the AllSettings method Conflicts: viper.go --- viper.go | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/viper.go b/viper.go index d9f97c8..be41206 100644 --- a/viper.go +++ b/viper.go @@ -350,19 +350,8 @@ func (v *Viper) MarshalKey(key string, rawVal interface{}) error { // Marshals the config into a Struct func Marshal(rawVal interface{}) error { return v.Marshal(rawVal) } func (v *Viper) Marshal(rawVal interface{}) error { - err := mapstructure.Decode(v.defaults, rawVal) - if err != nil { - return err - } - err = mapstructure.Decode(v.config, rawVal) - if err != nil { - return err - } - err = mapstructure.Decode(v.override, rawVal) - if err != nil { - return err - } - err = mapstructure.Decode(v.kvstore, rawVal) + err := mapstructure.WeakDecode(v.AllSettings(), rawVal) + if err != nil { return err }