Deprecation warning: Replace `exportloopref` with `copyloopvar` in `golangci-lint` configuration
When running golangci-lint locally, I encountered the following warning:
WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
It seems that exportloopref is no longer relevant in Go 1.22 and has been replaced by copyloopvar. It is better to update the linter configuration to remove exportloopref and enable copyloopvar instead.
If possible, please assign this issue to me, and I’ll fix it right away.
Additionally, if there’s anything wrong with how I’m submitting this issue or any improvements you’d suggest, please feel free to let me know. 😃
Good catch @derek10cloud thanks for submitting. Can you please let us know which version of golangci-lint you are using locally? You can interrogate with golangci-lint --version.
Right now, our CI uses v1.59.1, so this deprecation doesn't crop up... yet. We use version pinning, which is great for consistency and determinism. However, we just bump the pinned version from time to time, based on gut feel... which is probably not so great. Probably we should increment versions to latest stable on a not-too-frequent, not-too-infrequent interval. I have honestly not thought it through. Very happy to hear your thoughts on the matter.
@general-kroll-4-life Thanks for the response! I'm using golangci-lint v1.60.3 built with go1.22.7.
It looks like I might be on a version that's a bit too new.
I agree that version pinning is important for stability. A regular update schedule (e.g., every few months) might strike a good balance between staying up to date and maintaining consistency. Thanks for letting me know!