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

False positive on tests in go 1.22 / 1.21 w/ GOEXPERIMENT=loopvar #34

Closed
pkwarren opened this issue Feb 8, 2024 · 2 comments · Fixed by #35
Closed

False positive on tests in go 1.22 / 1.21 w/ GOEXPERIMENT=loopvar #34

pkwarren opened this issue Feb 8, 2024 · 2 comments · Fixed by #35

Comments

@pkwarren
Copy link

pkwarren commented Feb 8, 2024

In Go 1.22 (with GOEXPERIMENT=loopvar now the default), the Range statement for test <test> does not reinitialise the variable <var> linter is no longer accurate. If you take the example program linked from https://github.com/kunwardeep/paralleltest?tab=readme-ov-file#tparallel-is-called-in-the-range-method-and-test-case-variable-tc-being-used-but-is-not-reinitialised-more-info, you can see that it no longer reports incorrect output.

Is it possible to omit these warnings when running on Go 1.22+ or allow a mechanism to ignore these warnings?

@kunwardeep
Copy link
Owner

Hey @pkwarren, thanks for bringing this to my attention. Any chance you could submit a PR?

@ldez
Copy link
Contributor

ldez commented Feb 15, 2024

@kunwardeep I create a PR to add an option #35

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.

3 participants