conjungo
conjungo copied to clipboard
Proposal: Add option IgnoreEmpty to always ignore source value when it is zero
Useful in combination with overwrite to only overwrite if the source is actually set. One can also make that possible by providing his own default func, but I thought this feature is worth to be available directly. Backwards compatible, does not change the current behaviour (see tests).
reflect.Value{}.IsZero() is available since golang 1.13 and the issue leading to this function and the reasoning behind it: https://github.com/golang/go/issues/7501
My gut proposed to change how isEmpty() works, but that broke a lot of things as it is used in a lot of places. So I kept adding this feature with as minimal changes as possible