-
-
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.21 support #3922
go1.21 support #3922
Conversation
f07147f
to
78be407
Compare
For now, there is a problem with go-critic, I will investigate to understand the problem. Edit: I tested to run tests of go-critic itself with go1.21 and the problem is also here. |
As mentioned on Slack: if Go 1.21rc2 is installed in a module, |
4e2d847
to
f75ca78
Compare
I disabled Note: the Go version should be 1.21 inside go.modmodule your/module/name
go 1.21
//... .golangci.ymlrun:
go: '1.21' CLI flags--go=1.21 |
Day 1 issues, not yet supporting 1.21: golangci/golangci-lint#3922
* Adding slog * Disable golangci-lint Day 1 issues, not yet supporting 1.21: golangci/golangci-lint#3922
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
Disabling ruleguard does not fix the problem in Kubernetes. I first tried a config change:
Then I bumped the golangci-lint in Kubernetes to ldez:feat/go1.21 and also still got the same problem:
If I had to guess, I would say that gocritic loads ruleguard rules regardless whether the ruleguard check is enabled or not (haven't checked). |
@pohly From my memories, the problem was already here before go1.21.
The load of the embedded rules is done when gocritic is enabled. golangci-lint/pkg/golinters/gocritic.go Line 92 in 29f9717
|
Right, I also just found that. So to me it looks like all of gocritic is broken for Kubernetes because of this problem. |
Disabling gocritic entirely makes golangci-lint usable with 1.21 in Kubernetes, but that would be a pity. |
There was a different problem with having the Go toolchain inside the Go package. That got solved. Now go1.21 broke that again, with no solution so far. |
Have you tried with go-critic itself (standalone CLI)? |
go-critic works with go1.20.4 and go1.21rc4 when those are installed outside of Kubernetes. It also works with _output/local/.gimme/versions/go1.21rc3.linux.amd64/bin inside the Kubernetes repo but only if go-critic was compiled with go1.20.4. However, go-critic fails once it is compiled with go1.21rc3, no matter where the Go installation is located when invoking it. I'm a bit surprised by that because I thought I had seen a difference before when trying it with golangi-lint - perhaps I had made a mistake when testing. |
I would like to propose moving this discussion outside of this PR, maybe on Slack. EDIT: after discussing on the Gopher Slack, we decided to open an issue on the go-critic repo: go-critic/go-critic#1359 |
Just FYI regarding https://github.com/golangci/golangci-lint/pull/3922/files#diff-15c806aa509538190832852f439e9921a23bec2da81f95ed0e4bf13c14e5b160R44 With latest version it is still built with 1.20
Because of this I got errors such as
It's fixed if I compile it myself using go1.21 |
This line is to run some tests with the previous version of golangci-lint. The build use go1.21: golangci-lint/.github/workflows/tag.yml Line 19 in ed8eb4e
In your log I can see The official binaries: $ golangci-lint version
golangci-lint has version 1.54.1 built with go1.21.0 from a9378d9b on 2023-08-11T12:49:16Z |
Oh, you are right, I'm sorry, thanks |
This PR is to evaluate and prepare golangci-lint to go1.21.
This PR will evolve during the beta and RC phases of go1.21.