mirror of
https://github.com/Crocmagnon/fatcontext.git
synced 2024-11-22 16:08:09 +01:00
21 lines
318 B
Go
21 lines
318 B
Go
package contrib
|
|
|
|
import "context"
|
|
|
|
func ok() {
|
|
ctx := context.Background()
|
|
|
|
for i := 0; i < 10; i++ {
|
|
ctx := context.WithValue(ctx, "key", i)
|
|
_ = ctx
|
|
}
|
|
}
|
|
|
|
func notOk() {
|
|
ctx := context.Background()
|
|
|
|
for i := 0; i < 10; i++ {
|
|
ctx = context.WithValue(ctx, "key", i) // "nested context in loop"
|
|
_ = ctx
|
|
}
|
|
}
|