From 9cc584a3b7096614d45d75d1254a1f02bf53cc9c Mon Sep 17 00:00:00 2001 From: nizhiguo Date: Mon, 26 Aug 2024 14:50:47 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86find=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E4=B8=AD=20ToStringMapE=20=E4=B8=8D=E6=94=AF=E6=8C=81map[strin?= =?UTF-8?q?g]string=20map[string]FlagValue=20=E8=BD=AC=20map[string]interf?= =?UTF-8?q?ace{}?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- viper.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/viper.go b/viper.go index 5756137..b61199a 100644 --- a/viper.go +++ b/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 { // unify input map var m map[string]interface{} - switch mi.(type) { - case map[string]string, map[string]FlagValue: - m = cast.ToStringMap(mi) + switch miv := mi.(type) { + case map[string]string: + m = castMapStringToMapInterface(miv) + case map[string]FlagValue: + m = castMapFlagToMapInterface(miv) default: return "" }