mirror of
https://github.com/spf13/viper
synced 2024-11-04 20:27:02 +00:00
Fix broken tests
This commit is contained in:
parent
cd03c57ee4
commit
7956726f5e
2 changed files with 8 additions and 5 deletions
|
@ -60,6 +60,8 @@ func flattenAndMergeMap(shadow map[string]interface{}, m map[string]interface{},
|
||||||
switch val.(type) {
|
switch val.(type) {
|
||||||
case map[string]interface{}:
|
case map[string]interface{}:
|
||||||
m2 = val.(map[string]interface{})
|
m2 = val.(map[string]interface{})
|
||||||
|
case []interface{}:
|
||||||
|
m2 = cast.ToStringMap(val)
|
||||||
case map[interface{}]interface{}:
|
case map[interface{}]interface{}:
|
||||||
m2 = cast.ToStringMap(val)
|
m2 = cast.ToStringMap(val)
|
||||||
default:
|
default:
|
||||||
|
|
11
util.go
11
util.go
|
@ -190,12 +190,13 @@ func deepSearch(m map[string]interface{}, path []string) map[string]interface{}
|
||||||
m = m3
|
m = m3
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
m3, ok := m2.(map[string]interface{})
|
m3, isMap := m2.(map[string]interface{})
|
||||||
if !ok {
|
if !isMap {
|
||||||
// intermediate key is a value
|
// in case the intermediate value is not a map
|
||||||
// => replace with a new map
|
// a slice with previous value and a new map gets created
|
||||||
m3 = make(map[string]interface{})
|
m3 = make(map[string]interface{})
|
||||||
m[k] = m3
|
mixedValue := []interface{}{m2, m3}
|
||||||
|
m[k] = mixedValue
|
||||||
}
|
}
|
||||||
// continue search from here
|
// continue search from here
|
||||||
m = m3
|
m = m3
|
||||||
|
|
Loading…
Reference in a new issue