Skip to content

Commit

Permalink
only iterate over fields when map uses structs as keys
Browse files Browse the repository at this point in the history
  • Loading branch information
purehyperbole committed Jun 28, 2021
1 parent a077fc0 commit bad6782
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion patch_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (d *Differ) deleteMapEntry(c *ChangeValue, m, k, v *reflect.Value) {
return
}

if m != nil && m.CanSet() && v.IsValid() && v.Kind() != reflect.Int {
if m != nil && m.CanSet() && v.IsValid() && v.Kind() == reflect.Struct {
for x := 0; x < v.NumField(); x++ {
if !v.Field(x).IsZero() {
m.SetMapIndex(*k, *v)
Expand Down

0 comments on commit bad6782

Please sign in to comment.