Skip to content

Commit

Permalink
address addressable map values
Browse files Browse the repository at this point in the history
Fixes kr#10
  • Loading branch information
bmizerany committed May 18, 2022
1 parent 4178042 commit d9df86d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -353,8 +353,8 @@ func (d *differ) walk(e emitfer, av, bv reflect.Value, xformOk, wantType bool) {

for _, k := range sortedKeys(av, bv) {
esub := e.subf(t, "[%#v]", k)
ak := av.MapIndex(k)
bk := bv.MapIndex(k)
ak := addressable(av.MapIndex(k))
bk := addressable(bv.MapIndex(k))
esub.set(ak, bk)
if ak.IsValid() && bk.IsValid() {
d.walk(esub, ak, bk, true, false)
Expand Down
4 changes: 4 additions & 0 deletions diff_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ func TestEqual(t *testing.T) {
ab(make(chan int)),
ab(unsafe.Pointer(new(int))),
ab(unsafe.Pointer(nil)),
{
map[int]struct{ F int }{0: {}},
map[int]struct{ F int }{0: {}},
},
}

for _, tt := range cases {
Expand Down

0 comments on commit d9df86d

Please sign in to comment.