Skip to content

Commit

Permalink
Issue #100 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
darccio committed Jul 17, 2020
1 parent ad21779 commit 3c56715
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions issue100_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package mergo

import "testing"

type issue100s struct {
Member interface{}
}

func TestIssue100(t *testing.T) {
m := make(map[string]interface{})
m["Member"] = "anything"

st := &issue100s{}
if err := Map(st, m); err != nil {
t.Error(err)
}
}
2 changes: 1 addition & 1 deletion merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
case reflect.Ptr:
fallthrough
case reflect.Interface:
if src.IsNil() {
if isReflectNil(src) {
if overwriteWithEmptySrc && dst.CanSet() && src.Type().AssignableTo(dst.Type()) {
dst.Set(src)
}
Expand Down

0 comments on commit 3c56715

Please sign in to comment.