Crocmagnon / fatcontext

detects nested contexts in loops or function literals
MIT License
8 stars 1 forks source link

handle contexts inside nested blocks #14

Closed Crocmagnon closed 1 month ago

Crocmagnon commented 1 month ago

Looks like this use case isn't detected:

for {
    err := doSomething()
    if err != nil {
        ctx = context.WithValue(ctx, "key", "value")

        continue
    }

    doSomethingElse()
}

TODO:

Crocmagnon commented 1 month ago

There's a PR with a failing test case, if someone is interested in cracking this they're welcome :)

venkycode commented 1 month ago

taking this up

Crocmagnon commented 1 month ago

Sorry @venkycode, I had some spare time today so I tackled it.