mirror of
https://github.com/spf13/viper
synced 2024-12-22 19:47:01 +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) {
|
||||
case map[string]interface{}:
|
||||
m2 = val.(map[string]interface{})
|
||||
case []interface{}:
|
||||
m2 = cast.ToStringMap(val)
|
||||
case map[interface{}]interface{}:
|
||||
m2 = cast.ToStringMap(val)
|
||||
default:
|
||||
|
|
11
util.go
11
util.go
|
@ -190,12 +190,13 @@ func deepSearch(m map[string]interface{}, path []string) map[string]interface{}
|
|||
m = m3
|
||||
continue
|
||||
}
|
||||
m3, ok := m2.(map[string]interface{})
|
||||
if !ok {
|
||||
// intermediate key is a value
|
||||
// => replace with a new map
|
||||
m3, isMap := m2.(map[string]interface{})
|
||||
if !isMap {
|
||||
// in case the intermediate value is not a map
|
||||
// a slice with previous value and a new map gets created
|
||||
m3 = make(map[string]interface{})
|
||||
m[k] = m3
|
||||
mixedValue := []interface{}{m2, m3}
|
||||
m[k] = mixedValue
|
||||
}
|
||||
// continue search from here
|
||||
m = m3
|
||||
|
|
Loading…
Reference in a new issue