From a51b73284f48a6028024e0e4df81e3a9934a9a4a Mon Sep 17 00:00:00 2001 From: jackspirou Date: Thu, 30 Jul 2015 15:27:34 -0500 Subject: [PATCH 1/6] adding GetStringMapStringSlice method --- viper.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/viper.go b/viper.go index f2c09ce..9326299 100644 --- a/viper.go +++ b/viper.go @@ -455,6 +455,12 @@ func (v *Viper) GetStringMapString(key string) map[string]string { return cast.ToStringMapString(v.Get(key)) } +// Returns the value associated with the key as a map to a slice of strings +func GetStringMapStringSlice(key string) map[string]string { return v.GetStringMapStringSlice(key) } +func (v *Viper) GetStringMapStringSlice(key string) map[string]string { + return cast.ToStringMapStringSlice(v.Get(key)) +} + // Returns the size of the value associated with the given key // in bytes. func GetSizeInBytes(key string) uint { return v.GetSizeInBytes(key) } From 30232be240977ed707de6e2d8749c4d864a20de7 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Thu, 30 Jul 2015 15:38:59 -0500 Subject: [PATCH 2/6] using my own version of github.com/spf13/cast for now --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 9326299..7087b30 100644 --- a/viper.go +++ b/viper.go @@ -30,9 +30,9 @@ import ( "strings" "time" + "github.com/jackspirou/cast" "github.com/kr/pretty" "github.com/mitchellh/mapstructure" - "github.com/spf13/cast" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/pflag" ) From 0def2189a81eb90a30e1e6a78dec33af864ba47b Mon Sep 17 00:00:00 2001 From: jackspirou Date: Thu, 30 Jul 2015 15:43:18 -0500 Subject: [PATCH 3/6] typo: slice type needed --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 7087b30..11a1894 100644 --- a/viper.go +++ b/viper.go @@ -456,7 +456,7 @@ func (v *Viper) GetStringMapString(key string) map[string]string { } // Returns the value associated with the key as a map to a slice of strings -func GetStringMapStringSlice(key string) map[string]string { return v.GetStringMapStringSlice(key) } +func GetStringMapStringSlice(key string) map[string][]string { return v.GetStringMapStringSlice(key) } func (v *Viper) GetStringMapStringSlice(key string) map[string]string { return cast.ToStringMapStringSlice(v.Get(key)) } From e7be87777ce570cd0416585484270e78ed812b00 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Thu, 30 Jul 2015 15:44:12 -0500 Subject: [PATCH 4/6] changing import statements back --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 11a1894..8d216a2 100644 --- a/viper.go +++ b/viper.go @@ -30,9 +30,9 @@ import ( "strings" "time" - "github.com/jackspirou/cast" "github.com/kr/pretty" "github.com/mitchellh/mapstructure" + "github.com/spf13/cast" jww "github.com/spf13/jwalterweatherman" "github.com/spf13/pflag" ) From dd94a73d729e6eddd25682bfee40fc489a2edbf7 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Thu, 30 Jul 2015 15:46:38 -0500 Subject: [PATCH 5/6] fixing second slice type needed --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 8d216a2..2bc8db5 100644 --- a/viper.go +++ b/viper.go @@ -457,7 +457,7 @@ func (v *Viper) GetStringMapString(key string) map[string]string { // Returns the value associated with the key as a map to a slice of strings func GetStringMapStringSlice(key string) map[string][]string { return v.GetStringMapStringSlice(key) } -func (v *Viper) GetStringMapStringSlice(key string) map[string]string { +func (v *Viper) GetStringMapStringSlice(key string) map[string][]string { return cast.ToStringMapStringSlice(v.Get(key)) } From 1f5bca0dfdd7a3ace04d8d581f3b26a710242076 Mon Sep 17 00:00:00 2001 From: jackspirou Date: Mon, 3 Aug 2015 11:42:26 -0500 Subject: [PATCH 6/6] running tests again --- viper.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/viper.go b/viper.go index 2bc8db5..c9e9f09 100644 --- a/viper.go +++ b/viper.go @@ -455,7 +455,7 @@ func (v *Viper) GetStringMapString(key string) map[string]string { return cast.ToStringMapString(v.Get(key)) } -// Returns the value associated with the key as a map to a slice of strings +// Returns the value associated with the key as a map to a slice of strings. func GetStringMapStringSlice(key string) map[string][]string { return v.GetStringMapStringSlice(key) } func (v *Viper) GetStringMapStringSlice(key string) map[string][]string { return cast.ToStringMapStringSlice(v.Get(key))