Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glassonion1 committed Aug 21, 2024
1 parent ec4a6a1 commit ef9500e
Show file tree
Hide file tree
Showing 2 changed files with 203 additions and 187 deletions.
8 changes: 8 additions & 0 deletions copier.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,14 @@ func convert(src, dst reflect.Value) (bool, error) {
dst.Set(src.Elem().Convert(dst.Type()))
return true, nil
}
if dst.Type().Kind() == reflect.Ptr {
if src.Type().Elem().ConvertibleTo(dst.Type().Elem()) {
rv := reflect.New(dst.Type().Elem())
rv.Elem().Set(src.Elem().Convert(dst.Type().Elem()))
dst.Set(rv)
return true, nil
}
}
}

// from non pointer type to pointer type
Expand Down
Loading

0 comments on commit ef9500e

Please sign in to comment.