Skip to content

Commit

Permalink
Issue #1 fixed.
Browse files Browse the repository at this point in the history
It only required to check if src has kind reflect.Ptr. Iff it has this kind, it dereferences src calling Elem() on it.
  • Loading branch information
darccio committed Jun 26, 2014
1 parent b7bce79 commit 8cd7902
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mergo.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ func Merge(dst interface{}, src interface{}) error {
}
vDst := reflect.ValueOf(dst).Elem()
vSrc := reflect.ValueOf(src)
if vSrc.Kind() == reflect.Ptr {
vSrc = vSrc.Elem()
}
if vDst.Type() != vSrc.Type() {
return ErrDifferentArgumentsTypes
}
Expand Down

0 comments on commit 8cd7902

Please sign in to comment.