added one more case

This commit is contained in:
Venkatesh Kotwade 2024-08-26 01:35:09 +05:30
parent 89a1841d57
commit 387c533fad

View file

@ -65,6 +65,12 @@ func example() {
ctx = wrapContext(ctx) // want "nested context in function literal" 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 { func wrapContext(ctx context.Context) context.Context {