Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle contexts inside nested blocks #14

Closed
2 tasks done
Crocmagnon opened this issue Jul 12, 2024 · 3 comments · Fixed by #15
Closed
2 tasks done

handle contexts inside nested blocks #14

Crocmagnon opened this issue Jul 12, 2024 · 3 comments · Fixed by #15

Comments

@Crocmagnon
Copy link
Owner

Crocmagnon commented Jul 12, 2024

Looks like this use case isn't detected:

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

		continue
	}

	doSomethingElse()
}

TODO:

  • confirm with a test case
  • fix
@Crocmagnon
Copy link
Owner Author

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

@venkycode
Copy link
Contributor

taking this up

@Crocmagnon
Copy link
Owner Author

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

@Crocmagnon Crocmagnon changed the title handle contexts inside conditions handle contexts inside nested blocks Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants