From 5168378d8266edc8eebaf8eeceefeab84ce550c7 Mon Sep 17 00:00:00 2001 From: Miguel Eduardo Gil Biraud Date: Sat, 21 Jan 2017 01:53:06 +0100 Subject: [PATCH] Fix UnmarshalKey to use of defaultDecoderConfig --- viper.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 2603c78..40aaa3d 100644 --- a/viper.go +++ b/viper.go @@ -713,7 +713,15 @@ func (v *Viper) GetSizeInBytes(key string) uint { // UnmarshalKey takes a single key and unmarshals it into a Struct. func UnmarshalKey(key string, rawVal interface{}) error { return v.UnmarshalKey(key, rawVal) } func (v *Viper) UnmarshalKey(key string, rawVal interface{}) error { - return mapstructure.Decode(v.Get(key), rawVal) + err := decode(v.Get(key), defaultDecoderConfig(rawVal)) + + if err != nil { + return err + } + + v.insensitiviseMaps() + + return nil } // Unmarshal unmarshals the config into a Struct. Make sure that the tags