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

Issue #84 not fully solved yet #115

Closed
yannh opened this issue Apr 25, 2019 · 1 comment
Closed

Issue #84 not fully solved yet #115

yannh opened this issue Apr 25, 2019 · 1 comment

Comments

@yannh
Copy link
Contributor

yannh commented Apr 25, 2019

Hello 👋 I wrote the following test which fails (renamed from a Issue84 test with a similar problem)

func TestIssue84MergeMapWithNilValueToStructWithOverride(t *testing.T) {
	p1 := map[string]interface{}{
		"A": 0, "B": 1, "C": 2,
	}
	p2 := map[string]interface{}{
		"D": nil,
	}
	if err := Map(&p1, p2, WithOverride); err != nil {
		t.Fatalf("Error during the merge: %v", err)
	}
	if _, ok := p1["D"]; !ok  {
		t.Errorf("p1 should contain D: %+v", p1)
	}
}

It prints:

p1 should contain D: map[A:0 B:1 C:2]

Would I be correct to expect p1 to contain map[A:0 B:1 C:2 D:nil] ?
If yes, I can have a go at fixing it - let me know if you want to reopen #84 (it seems to be a similar problem) or if I should create a new test file. Thanks!

@darccio
Copy link
Owner

darccio commented Jul 16, 2020

PR for this issue merged

@darccio darccio closed this as completed Jul 16, 2020
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

No branches or pull requests

2 participants