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

Mergo is not overriding destination map key with empty value with WithOverwriteWithEmptyValue #230

Closed
rquitales opened this issue Mar 8, 2023 · 0 comments · Fixed by #231

Comments

@rquitales
Copy link
Contributor

rquitales commented Mar 8, 2023

When trying to merge two maps, mergo does not respectWithOverwriteWithEmptyValue.

Eg:

destination := map[string]string{"a": "valueOfA"}
source := map[string]string{"b": "valueOfB", "c": "valueOfC"}

mergo.Merge(&destination, &source, mergo.WithOverwriteWithEmptyValue)

Current output:
map[a:valueOfA b:valueOfB c:valueOfC]

Expected output:
map[b:valueOfB c:valueOfC]
Since "a" should be discarded with provided WithOverwriteWithEmptyValue option.

Playground: https://go.dev/play/p/kR8K-G7sPPt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant