conjungo icon indicating copy to clipboard operation
conjungo copied to clipboard

Proposal: Add option IgnoreEmpty to always ignore source value when it is zero

Open dionysius opened this issue 5 years ago • 0 comments

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

dionysius avatar Oct 22 '20 11:10 dionysius