kunwardeep / paralleltest

Linter to check if your tests have been marked as parallel correctly
MIT License
48 stars 12 forks source link

Nested range causes false positive "Range statement [..] does not reinitialise the variable" #12

Closed prashantv closed 1 year ago

prashantv commented 2 years ago

Repro: https://gist.github.com/prashantv/9febe96e7df2b0d5311fa3b4aedb3059

Using the latest release of paralleltest (1.0.3) raises an incorrect issue:

[...]/foo_test.go:27:2: Range statement for test TestFoo does not reinitialise the variable tt2

tt2 is reinitialized: https://gist.github.com/prashantv/9febe96e7df2b0d5311fa3b4aedb3059#file-foo_test-go-L31

This seems related to https://github.com/kunwardeep/paralleltest/issues/8 (though the last comment on the issue indicates the issue is fixed)

kunwardeep commented 2 years ago

Hey @prashantv, unfortunately, I am not doing active development on this., but I would be more than happy to look at a PR if you have one.

kunwardeep commented 2 years ago

Hey @prashantv would you be able to test this with the latest fix?