mergeMaps support update diff type values

This commit is contained in:
lousong 2024-06-24 16:45:42 +08:00
parent 01e104428a
commit 2b0ff92949

View file

@ -1649,13 +1649,19 @@ func mergeMaps(
svType := reflect.TypeOf(sv)
tvType := reflect.TypeOf(tv)
if svType != tvType {
v.logger.Errorf("svType != tvType; key=%s, st=%v, tt=%v, sv=%v, tv=%v", sk, svType, tvType, sv, tv)
// type different
diffType := svType != tvType
v.logger.Debugf("processing key=%s, st=%v, tt=%v, sv=%v, tv=%v, diffType=%v", sk, svType, tvType, sv, tv, diffType)
// just update when type different
if diffType {
v.logger.Debugf("setting diffType value")
tgt[tk] = sv
if itgt != nil {
itgt[tk] = sv
}
continue
}
v.logger.Debugf("processing key=%s, st=%v, tt=%v, sv=%v, tv=%v", sk, svType, tvType, sv, tv)
switch ttv := tv.(type) {
case map[interface{}]interface{}:
v.logger.Debugf("merging maps (must convert)")