Merge without override assume false is a valid non empty type
kotyara85 opened this issue · comments
Here's an example
type Option struct {
test bool
}
o := Option{}
mergo.Merge(&o, &Option{test: true})
In this example test will be false. WithOverride won't really work here, because any other type will be overwritten in this case.
I guess custom transformers will help here?
Thanks for opening a new issue. The team has been notified and will review it as soon as possible.
For urgent issues and priority support, visit https://xscode.com/imdario/mergo
I don't think this problem is just unexported variables. I think any false
is considered empty and thus doesn't have the expected behavior.
@rfay I confirm it's just unexported variables, as @nilsgstrabo pointed. If you test it exporting test
, it works as expected (no false
value overrides a true
value).