mirror of
https://github.com/spf13/viper
synced 2025-05-05 19:57:18 +00:00
处理find方法中 ToStringMapE 不支持map[string]string map[string]FlagValue 转 map[string]interface{}
This commit is contained in:
parent
0c7eef9240
commit
9cc584a3b7
1 changed files with 5 additions and 3 deletions
8
viper.go
8
viper.go
|
@ -542,9 +542,11 @@ func (v *Viper) isPathShadowedInDeepMap(path []string, m map[string]interface{})
|
||||||
func (v *Viper) isPathShadowedInFlatMap(path []string, mi interface{}) string {
|
func (v *Viper) isPathShadowedInFlatMap(path []string, mi interface{}) string {
|
||||||
// unify input map
|
// unify input map
|
||||||
var m map[string]interface{}
|
var m map[string]interface{}
|
||||||
switch mi.(type) {
|
switch miv := mi.(type) {
|
||||||
case map[string]string, map[string]FlagValue:
|
case map[string]string:
|
||||||
m = cast.ToStringMap(mi)
|
m = castMapStringToMapInterface(miv)
|
||||||
|
case map[string]FlagValue:
|
||||||
|
m = castMapFlagToMapInterface(miv)
|
||||||
default:
|
default:
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue