-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
exportloopref: deprecation #4916
Conversation
What’s the benefit of keeping the linter active when using Go >= 1.22? All of its output is then no longer relevant and should be ignored, really all of it.
In addition to the deprecation, it imo thus makes sense to also disable the linter for the relevant versions of Go as done with #4915.
|
Because the priority is for users to stop using it, they should remove it from their configuration, so the "false-positives" reports will be a reminder. |
What about people using |
This is how the depreciation cycle works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I agree not "hiding" this and asking users to disable deprecated linters is the right way so they're aware they will go away. This one might be special since it's bot needed but better to be consistent.
I don't know how common enabling all without a config file is but if you have a config file it's a one time-one line fix.
Since Go1.22 (and go1.21 with
GOEXPERIMENT=loopvar
),exportloopref
is no longer relevant.It should be replaced by
copyloopvar
.It's a level 1 deprecation (the linter still runs) but we will keep the level 1 until the release of go1.24.
And as golangci-lint requires min go1.22 to compile we can drop variable copies inside the code.
Reminder: the Go team only maintains the 2 latest "minor" versions of Go (go1.22 and go1.23), and go1.22 was released on 2024-02-06, so it's highly recommended not to use go1.21 or lower.