Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

overwriteWithEmptyValue is forced to true when merging an object involving maps #187

Closed
liggitt opened this issue Apr 15, 2021 · 5 comments

Comments

@liggitt
Copy link

liggitt commented Apr 15, 2021

#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

#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.
Fund with Polar
@xscode-auto-reply
Copy link

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

@darccio
Copy link
Owner

darccio commented Apr 15, 2021

@liggitt I regret I'm unable to fix this in a quick way. Can you provide a PR?

wadey added a commit to slackhq/nebula that referenced this issue Nov 3, 2021
It looks like there is a bad bug in newer versions:

- darccio/mergo#187
- kubernetes/kubernetes#101120 (review)
wadey added a commit to slackhq/nebula that referenced this issue Apr 6, 2022
I forgot about this bug:

- darccio/mergo#187
@darccio darccio added the v2 label Sep 11, 2023
@darccio
Copy link
Owner

darccio commented Sep 11, 2023

Fixing this in v2.

@haircommander
Copy link

hey @darccio I am curious about v2 timeline. I believe we're hitting this issue in kubernetes/kubernetes#121193 and it's not clear to me how to work around this behavior.

@darccio
Copy link
Owner

darccio commented Oct 21, 2023

@haircommander There is no planned timeline. I work on Mergo in my spare time. I will appreciate any help on this.

vsemichev added a commit to vsemichev/mergo that referenced this issue Jun 5, 2024
vsemichev added a commit to vsemichev/mergo that referenced this issue Jun 5, 2024
vsemichev added a commit to vsemichev/mergo that referenced this issue Jun 5, 2024
vsemichev added a commit to vsemichev/mergo that referenced this issue Aug 8, 2024
darccio added a commit that referenced this issue Aug 17, 2024
@darccio darccio closed this as completed Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants