From 31d0f6cf8a84a5a09412caf54b92c1cca886c6c7 Mon Sep 17 00:00:00 2001 From: xukesong Date: Thu, 13 Jul 2023 14:54:24 +0800 Subject: [PATCH] fix isPathShadowedInFlatMap type cast bug --- viper.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/viper.go b/viper.go index 0158a7f..0e63350 100644 --- a/viper.go +++ b/viper.go @@ -827,9 +827,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 "" }