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

feat: add ignoreloopvar option #35

Merged
merged 1 commit into from
Feb 15, 2024
Merged

Conversation

ldez
Copy link
Contributor

@ldez ldez commented Feb 15, 2024

Fixes #34

I didn't create something based on build tags because inside golangci-lint we need to be on compatible with go.21 builds.

@kunwardeep kunwardeep merged commit 2ac0c2f into kunwardeep:main Feb 15, 2024
1 check passed
@ldez ldez deleted the fix/loopvar branch February 15, 2024 23:20
@ldez
Copy link
Contributor Author

ldez commented Feb 15, 2024

@kunwardeep do you plan to create a release?

@kunwardeep
Copy link
Owner

Done @ldez

@AxelPrel
Copy link

im currently adding this linter to my stack with go 1.22+. i did not see the ignore-loop-var:true option in golangCI linter settings page(https://golangci-lint.run/usage/linters/#paralleltest) but i added it anyway in my .golangci.yml config file and it seems to work.
i think this config should work just like the intrange linter (https://github.com/ckaznocha/intrange) , meaning if golangCI detect a 1.22+ go version it will automatically set ignore-loop-var: true

@ldez
Copy link
Contributor Author

ldez commented Jun 12, 2024

ignoreloopvar is not an option for golangci-lint because golangci-lint automatically enables it based on the Go version.

i added it anyway in my .golangci.yml config file and it seems to work.

The option is ignored from the configuration.

golangci/golangci-lint#4405

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 this pull request may close these issues.

False positive on tests in go 1.22 / 1.21 w/ GOEXPERIMENT=loopvar
3 participants