copier
copier copied to clipboard
source with nil pointer replacing existing pointer in destination
Reproducible Example
Description
expectation
Should not replace non-nil pointer with nil or non existing data
This is the line of code that lead to this behavior: https://github.com/jinzhu/copier/blob/0e264e93b8f4334ee24e3d8811e3f76c50734258/copier.go#L462-L467
But it seems to me that it is that intended behavior because a nil is also a value that should be copied as if other values. Setting IgnoreEmpty in copier.Option could achieve what you want. However, not only it would ignore nil pointers in source, but also ignore zero values such as empty strings.