copier
copier copied to clipboard
Fixed issue with nested pointer structs
Fixes https://github.com/jinzhu/copier/issues/99
An alternative to using defer/recover is to utilize the FieldByIndexErr
, but it's only available in 1.18+
structField, ok := source.Type().FieldByName(fieldName)
if !ok {
return reflect.Value{}
}
field, err := source.FieldByIndexErr(structField.Index)
if err != nil {
return reflect.Value{}
}
return field