Skip to content

Commit

Permalink
fixes issue #187. attempt #2
Browse files Browse the repository at this point in the history
  • Loading branch information
vsemichev committed Jun 5, 2024
1 parent 6b830ff commit a13a117
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion map.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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()
}
}
Expand Down

0 comments on commit a13a117

Please sign in to comment.