We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e9e29f commit 0e13d06Copy full SHA for 0e13d06
testdata/src/example.go
@@ -59,9 +59,15 @@ func inStructs(ctx context.Context) {
59
c.Ctx = context.WithValue(c.Ctx, "other", "val")
60
}
61
62
+ r := []struct{ Ctx context.Context }{{ctx}}
63
for i := 0; i < 10; i++ {
- 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")
+ r[0].Ctx = context.WithValue(r[0].Ctx, "key", i) // want "nested context in loop"
+ 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")
72
73
0 commit comments