-
-
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
go1.22 support #4273
Comments
@ldez Btw, I'm using golangci-lint with Go 1.22. Haven't seen any errors so far. |
If you are not using any specific Go1.22 elements, yes it may work but we don't provide support on versions of golangci-lint, that are not compiled with go1.22, used with go1.22 code, because the behavior will depend on the code to analyze. |
@ldez Thank you for supporting go1.22! It seems that golangci-lint 1.56.0 detects loopclosure error even when the golang version is 1.22. module playground
go 1.22.0 package main
import (
"fmt"
"sync"
)
func main() {
var wg sync.WaitGroup
wg.Add(5)
for i := 0; i < 5; i++ {
go func() {
defer wg.Done()
fmt.Println(i)
}()
}
wg.Wait()
} ❯ go version
go version go1.22.0 darwin/arm64
❯ golangci-lint version
golangci-lint has version 1.56.0 built with go1.22.0 from 1a00b409 on 2024-02-07T14:39:45Z
❯ golangci-lint run
main.go:14:16: loopclosure: loop variable i captured by func literal (govet)
fmt.Println(i)
^ I think the loopclosure checker itself is designed not to detect loopclosure as invalid in Go 1.22. |
Hello, this rule can be disabled: linters-settings:
govet:
disable:
- loopclosure I will see if I can improve the default behavior. |
A new version is available: https://github.com/golangci/golangci-lint/releases/tag/v1.56.1 |
I think, we need to disable this "loopclosure" check in
|
Before the modification of the linter itself, you can add the following configuration to ignore this report: issues:
exclude-rules:
- text: Range statement for test TestName does not reinitialise the variable test
linters:
- paralleltest |
Hi @ldez, is GOEXPERIMENT=rangefunc supported by 1.56 release already? I got some of the following errors when checking code with GOEXPERIMENT=rangefunc enabled:
|
Hi @changkun, |
I will close this issue as the global support of go1.22 is now done, if you have problems please consider opening a dedicated issue. |
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
golangci-lint supports go1.22 since v1.56.0, per golangci/golangci-lint#4273. Switch to using Github Actions for lint check.
EDIT: since v1.56.0 golangci supports go1.22 🎉
Is golangci-lint support go1.22?
No, and yes.
Basically, golangci-lint supports Go versions lower or equal to the Go version used to build it.
The current binaries from the releases page and the Docker images have been built with go1.21 and will be built with go1.21 as long as go1.22 is not GA.
So those binaries/images don't support go1.22 (new elements and internal Go changes).
https://golangci-lint.run/usage/faq/#which-go-versions-are-supported
In addition, of the Go version used to build it, some linters could need to be updated to support newer versions of Go, and internal pieces of golangci-lint could also need to be updated.
You can follow the PR #4272 to see the progress on this topic.
Sponsoring is a good way to sustain open source maintainers: sponsor me
The text was updated successfully, but these errors were encountered: