From 1af7e370716285eb8cbf345251d2eab231e30524 Mon Sep 17 00:00:00 2001 From: Diep Pham Date: Mon, 10 Apr 2017 15:56:10 +0700 Subject: [PATCH] fixes unmarshalKey doesn't work with time.Duration --- viper.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/viper.go b/viper.go index 22a2ed8..41822c0 100644 --- a/viper.go +++ b/viper.go @@ -52,7 +52,7 @@ func init() { type remoteConfigFactory interface { Get(rp RemoteProvider) (io.Reader, error) Watch(rp RemoteProvider) (io.Reader, error) - WatchChannel(rp RemoteProvider)(<-chan *RemoteResponse, chan bool) + WatchChannel(rp RemoteProvider) (<-chan *RemoteResponse, chan bool) } // RemoteConfig is optional, see the remote package @@ -719,7 +719,7 @@ 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) + return decode(v.Get(key), defaultDecoderConfig(rawVal)) } // Unmarshal unmarshals the config into a Struct. Make sure that the tags