diff --git a/testdata/src/example.go b/testdata/src/example.go index 12f69a5..e72813f 100644 --- a/testdata/src/example.go +++ b/testdata/src/example.go @@ -65,6 +65,12 @@ func example() { ctx = wrapContext(ctx) // want "nested context in function literal" } + // this is fine because the context is created in the loop + for { + if ctx := context.Background(); doSomething() != nil { + ctx = wrapContext(ctx) + } + } } func wrapContext(ctx context.Context) context.Context {