-
Notifications
You must be signed in to change notification settings - Fork 649
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
[CI] Update golangci to v2 #4048
Conversation
26ed86a
to
4878f25
Compare
# - gomodguard | ||
# - goprintffuncname | ||
# - gosec (gas) | ||
- gosimple # (megacheck) |
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.
Now part of staticcheck.
enable: | ||
- depguard | ||
- gofmt | ||
- goimports |
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.
They are now "formatters".
gofmt is down there - goimports is not necessary as we use gci instead.
run: | ||
concurrency: 6 | ||
timeout: 5m | ||
modules-download-mode: readonly |
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.
concurrency does not help - we should let it pick whatever matches max proc.
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.
timeout here does not help either - we have timeouts everywhere, and it is hard to figure out which ones kicks when.
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.
timeout here does not help either - we have timeouts everywhere, and it is hard to figure out which ones kicks when.
The idea was to limit the CI to avoid overflow and optimize.
- govet | ||
- ineffassign | ||
- misspell | ||
- nakedret | ||
- prealloc | ||
- typecheck |
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.
No longer a linter and cannot be disabled.
.golangci.yml
Outdated
- "-ST1021" | ||
- "-ST1022" | ||
# FIXME: this below this point is disabled for now, but we should investigate | ||
- "-QF1008" |
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.
These are new checks in staticcheck that we do not pass. Some of them are just annoying, but others are more interesting and we should look into this.
settings: | ||
gci: | ||
sections: | ||
- standard |
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.
gci is what replaces our import reviser and that configuration defines how we want our import sectioned.
Note: this is independent from the ongoing work on Tigron, though I would prefer to get it merged first before the upcoming changes in test.command. |
4878f25
to
6e6349a
Compare
# golangci: v2.0.2 (2024-03-26) | ||
# git-validation: main (2025-02-25) | ||
# ltag: main (2025-03-04) | ||
# go-licenses: v2.0.0-alpha.1 (2024-06-27) |
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.
These irrelevant lines will probably disappear after rebasing
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.
Mmmm...
Not completely sure what you mean - but these have been updated on mod/tigron/Makefile - not yet on nerdctl/Makefile, so they are part of this changeset, right?
.golangci.yml
Outdated
- "-ST1021" | ||
- "-ST1022" | ||
# FIXME: this below this point is disabled for now, but we should investigate | ||
- "-QF1008" |
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.
Googled this, only got flight information about Qantas Airways 😅
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.
HAHAHA
Hi @apostasie, thanks for pushing the v2 version. Did you use the migration tools to make the changes? |
6e6349a
to
ddd7d96
Compare
Signed-off-by: apostasie <[email protected]>
ddd7d96
to
994190a
Compare
@@ -30,6 +30,7 @@ import ( | |||
|
|||
"github.com/containerd/nerdctl/mod/tigron/expect" | |||
"github.com/containerd/nerdctl/mod/tigron/test" | |||
|
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.
This is one of the differences between gci and go-imports-reviser.
hey @fahedouch ! Yes, I started from the output of the migration tool and guide. |
@AkihiroSuda @fahedouch just added a few changes:
Also working on a follow-on PR to fix a bunch of issues and enable some rules. |
CI failure looks like GHA cache garbage collection tripping us. |
Rootless failure is #4046 |
&& go install gotest.tools/gotestsum@ac6dad9c7d87b969004f7749d1942938526c9716 | ||
@echo "Remember to add GOROOT/bin to your path" | ||
@echo "Remember to add \$$HOME/go/bin to your path" |
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.
This path depends on GOPATH, GOBIN
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.
Right.
Will amend in a follow-on "cleanup" PR.
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.
Thanks
Thanks |
This updates golangci to their newly released v2.
gci
(bundled with golangci) with 99% compatibility (save a handful of changes required in code)I opted to configure the new .golangci.yml for the minimal set of changes to the source code.
However, that meant disabling a bunch of checks from
staticcheck
and a couple of formatters, that we may want to investigate / enable.