We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi @imdario
We merged two maps with Override and also AppendSlice , which is taking Override as high precedence than AppendSlice for slices too.
Expected behaviour: We want Override for non-slice and AppendSlice for slice. The following Test should PASS, but it's failing currently
PASS
func TestMergeWithOverrideAndAppendSlice(t *testing.T) { aMap := map[string]interface{}{ "key1": []int{3}, "key2": "valueA2", } bMap := map[string]interface{}{ "key1": []int{1, 2}, "key2": "valueB2", "key3": "valueB3", } expectedMap := map[string]interface{}{ "key1": []int{1, 2, 3}, "key2": "valueB2", "key3": "valueB3", } err := Merge(&aMap, bMap, WithAppendSlice, WithOverride) if err != nil { t.Errorf("Test failed with error: %v", err) } if !reflect.DeepEqual(aMap, expectedMap) { t.Errorf("Actual: %#v did not match \nExpected: %#v", aMap, expectedMap) } }
We went through the code and found it's because of this part of code
https://github.com/imdario/mergo/blob/master/merge.go#L139
Could you explain the meaning for this code?
The text was updated successfully, but these errors were encountered:
Sorry for not answering before. Please test this against the last release (v0.3.7) as it fixes some bugs related to Override.
Sorry, something went wrong.
@imdario It's working as expected in the new version. Thanks!
No branches or pull requests
Hi @imdario
We merged two maps with Override and also AppendSlice , which is taking Override as high precedence than AppendSlice for slices too.
Expected behaviour: We want Override for non-slice and AppendSlice for slice. The following Test should
PASS
, but it's failing currentlyWe went through the code and found it's because of this part of code
https://github.com/imdario/mergo/blob/master/merge.go#L139
Could you explain the meaning for this code?
The text was updated successfully, but these errors were encountered: