Fix value merging for empty lists #2995
Open
+104
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This fixes our behavior to match upstream's when merging empty lists. We now produce an empty list instead of a no-op.
The bug was due to this logic which initialized a slice as
nil
. This was then passed tomergo.Merge
which ignores zero values by default, hence why the original value was not overridden.This PR changes our
allowNullValues
logic to use upstream's merge behavior more directly since the intention behind that flag is to match upstream as closely as possible.Importantly, this doesn't fix #2034 because we're still unmarshaling inputs with
SkipNulls: true
. In practiceallowNullValues
behaves more likeallowEmptyValues
because our unmarshaling strips away all of the meaningfulnil
values. That fix will be in another PR.Fixes #2731.
Refs #2034.
Refs #2963.