From a13a1175be733af04b175c9fe616f594c5e8dfa9 Mon Sep 17 00:00:00 2001 From: vsemichev Date: Wed, 5 Jun 2024 14:57:24 -0400 Subject: [PATCH] fixes issue #187. attempt #2 --- map.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/map.go b/map.go index f7461e5..9e6a2db 100644 --- a/map.go +++ b/map.go @@ -32,6 +32,7 @@ func isExported(field reflect.StructField) bool { // The map argument tracks comparisons that have already been seen, which allows // short circuiting on recursive types. func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, config *Config) (err error) { + fmt.Println("In deepMap") overwrite := config.Overwrite if dst.CanAddr() { addr := dst.UnsafeAddr() @@ -58,7 +59,7 @@ func deepMap(dst, src reflect.Value, visited map[uintptr]*visit, depth int, conf } fieldName := field.Name fieldName = changeInitialCase(fieldName, unicode.ToLower) - if v, ok := dstMap[fieldName]; !ok || (isEmptyValue(reflect.ValueOf(v), !config.ShouldNotDereference) && overwrite) { + if _, ok := dstMap[fieldName]; !ok || (!isEmptyValue(reflect.ValueOf(src.Field(i).Interface()), !config.ShouldNotDereference) && overwrite) { dstMap[fieldName] = src.Field(i).Interface() } }