Fix array test

The prior construct probably shouldn't issue an error.
These, however, both should (and do).
This commit is contained in:
Michael Urman 2024-05-29 10:07:03 -05:00
parent 3e9e29f41c
commit 0e13d068ad

View file

@ -59,9 +59,15 @@ func inStructs(ctx context.Context) {
c.Ctx = context.WithValue(c.Ctx, "other", "val") c.Ctx = context.WithValue(c.Ctx, "other", "val")
} }
r := []struct{ Ctx context.Context }{{ctx}}
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
c := []*struct{ Ctx context.Context }{{ctx}} r[0].Ctx = context.WithValue(r[0].Ctx, "key", i) // want "nested context in loop"
c[0].Ctx = context.WithValue(c[0].Ctx, "key", i) // want "nested context in loop" r[0].Ctx = context.WithValue(r[0].Ctx, "other", "val")
c[0].Ctx = context.WithValue(c[0].Ctx, "other", "val") }
rp := []*struct{ Ctx context.Context }{{ctx}}
for i := 0; i < 10; i++ {
rp[0].Ctx = context.WithValue(rp[0].Ctx, "key", i) // want "nested context in loop"
rp[0].Ctx = context.WithValue(rp[0].Ctx, "other", "val")
} }
} }