From 387c533fad143d77bb0b4f54c14609fa197e4f8c Mon Sep 17 00:00:00 2001 From: Venkatesh Kotwade Date: Mon, 26 Aug 2024 01:35:09 +0530 Subject: [PATCH] added one more case --- testdata/src/example.go | 6 ++++++ 1 file changed, 6 insertions(+) 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 {