Skip to content

Commit 0e13d06

Browse files
committed
Fix array test
The prior construct probably shouldn't issue an error. These, however, both should (and do).
1 parent 3e9e29f commit 0e13d06

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

testdata/src/example.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,15 @@ func inStructs(ctx context.Context) {
5959
c.Ctx = context.WithValue(c.Ctx, "other", "val")
6060
}
6161

62+
r := []struct{ Ctx context.Context }{{ctx}}
6263
for i := 0; i < 10; i++ {
63-
c := []*struct{ Ctx context.Context }{{ctx}}
64-
c[0].Ctx = context.WithValue(c[0].Ctx, "key", i) // want "nested context in loop"
65-
c[0].Ctx = context.WithValue(c[0].Ctx, "other", "val")
64+
r[0].Ctx = context.WithValue(r[0].Ctx, "key", i) // want "nested context in loop"
65+
r[0].Ctx = context.WithValue(r[0].Ctx, "other", "val")
66+
}
67+
68+
rp := []*struct{ Ctx context.Context }{{ctx}}
69+
for i := 0; i < 10; i++ {
70+
rp[0].Ctx = context.WithValue(rp[0].Ctx, "key", i) // want "nested context in loop"
71+
rp[0].Ctx = context.WithValue(rp[0].Ctx, "other", "val")
6672
}
6773
}

0 commit comments

Comments
 (0)