Closed sudo-suhas closed 3 years ago
Possible it's trying to call the reflectValue.Elem()
on a nil reflect.Value
, so it won't have an exact Elem()
. But correct me if I'm not right.
@sudo-suhas have you found any fix for this?
No.
@qzyse2017 Can't agree, it's just a temporary solution. What if we have 300 nested field? It should be handled inside the library, if the nested field is nil, then reflect.New with the type of the field.
Hey. Any update on this? Is fix coming to the library?
This example uses unexported anonymous fields. Unexported fields cannot be copied to. PR #72 adds support for exported anonymous fields and avoid panic in case of anonymous fields.
The following code causes a panic:
stack trace:
The issue originates from this: https://github.com/jinzhu/copier/blob/db4671f3a9b8df855e993f7c94ec5ef1ffb0a23b/copier.go#L71
Is this something that can be fixed in
copier
? I don't know enough about reflection but if you can guide me, I can make a PR to fix this.