jinzhu / copier

Copier for golang, copy value from struct to struct and more
MIT License
5.58k stars 490 forks source link

Prevent mismatched types (struct -> non-struct) in a copy from panicing. #18

Closed gavbaa closed 3 years ago

gavbaa commented 7 years ago

If a field in the struct being copied is a struct has the same name in the struct being copied to, but the field in the struct being copied to is not a struct but a simple type, previously we would get a panic.

This change just has the code fall through the attempt at copying the struct into the simple field. Patch includes new test demonstrating this behavior, all tests pass.

jinzhu commented 3 years ago

codebase out of date ;(