mirror of
https://github.com/spf13/viper
synced 2025-05-11 22:57:21 +00:00
return map[string]interface in order to work with cast.ToStringMap
This commit is contained in:
parent
d6288da8b8
commit
018de44cf7
1 changed files with 2 additions and 2 deletions
4
viper.go
4
viper.go
|
@ -1181,14 +1181,14 @@ func readAsCSV(val string) ([]string, error) {
|
||||||
return csvReader.Read()
|
return csvReader.Read()
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseStringToStringFlagValue(val string) map[string]string {
|
func parseStringToStringFlagValue(val string) map[string]interface{} {
|
||||||
s := strings.TrimPrefix(val, "[")
|
s := strings.TrimPrefix(val, "[")
|
||||||
s = strings.TrimSuffix(s, "]")
|
s = strings.TrimSuffix(s, "]")
|
||||||
if s == "" {
|
if s == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
elements := strings.Split(s, ",")
|
elements := strings.Split(s, ",")
|
||||||
result := make(map[string]string, len(elements))
|
result := make(map[string]interface{}, len(elements))
|
||||||
for _, element := range elements {
|
for _, element := range elements {
|
||||||
pair := strings.SplitN(element, "=", 2)
|
pair := strings.SplitN(element, "=", 2)
|
||||||
if len(pair) != 2 {
|
if len(pair) != 2 {
|
||||||
|
|
Loading…
Add table
Reference in a new issue