mergo
mergo copied to clipboard
overwriteWithEmptyValue is forced to `true` when merging an object involving maps
https://github.com/imdario/mergo/pull/85 introduced a bug that can leave overwriteWithEmptyValue
set to true if a map is encountered, but one of the continue
or return
statements is called before calling deepMerge
(which reset to false
)
https://github.com/imdario/mergo/blob/29fb3d3bdc5512887f1dc9aedde6a0fed407fa8f/map.go#L72-L100
https://github.com/imdario/mergo/pull/133 made the bug worse by removing the reset to false
in deepMerge
, so now, any merge involving a map leaves overwriteWithEmptyValue
set to true for all remaining merges.
Upvote & Fund
- We're using Polar.sh so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.
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
@liggitt I regret I'm unable to fix this in a quick way. Can you provide a PR?
Fixing this in v2.
hey @darccio I am curious about v2 timeline. I believe we're hitting this issue in https://github.com/kubernetes/kubernetes/pull/121193 and it's not clear to me how to work around this behavior.
@haircommander There is no planned timeline. I work on Mergo in my spare time. I will appreciate any help on this.