-
Notifications
You must be signed in to change notification settings - Fork 885
Fix lint failing under Go 1.27 #1335
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,32 +1,47 @@ | ||
| run: | ||
| timeout: 10m | ||
|
|
||
| version: "2" | ||
| linters: | ||
| disable-all: true | ||
| default: none | ||
| enable: | ||
| - dupl | ||
| - errorlint | ||
| - gofmt | ||
| - goimports | ||
| - gomodguard | ||
| - gosimple | ||
| - gomodguard_v2 | ||
| - govet | ||
| - ineffassign | ||
| - misspell | ||
| - nakedret | ||
| - revive | ||
| - unused | ||
| - staticcheck | ||
|
|
||
| linters-settings: | ||
| gofmt: | ||
| simplify: true | ||
| gomodguard: | ||
| blocked: | ||
| modules: | ||
| - github.com/pkg/errors: | ||
| recommendations: | ||
| - errors | ||
| - fmt | ||
| dupl: | ||
| threshold: 400 | ||
| - unused | ||
| settings: | ||
| dupl: | ||
| threshold: 400 | ||
| gomodguard_v2: | ||
| blocked: | ||
| - module: github.com/pkg/errors | ||
| recommendations: | ||
| - errors | ||
| - fmt | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
| settings: | ||
| gofmt: | ||
| simplify: true | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ |
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -41,6 +41,7 @@ FIGURE_FILES := \ | |||||||||||||||
| img/media-types.png | ||||||||||||||||
|
|
||||||||||||||||
| MARKDOWN_LINT_VER?=v0.8.1 | ||||||||||||||||
| GOLANGCI_LINT_VER?=v2.13.0 | ||||||||||||||||
|
|
||||||||||||||||
| TOOLS := gitvalidation | ||||||||||||||||
|
|
||||||||||||||||
|
|
@@ -118,13 +119,7 @@ install.tools: $(TOOLS:%=.install.%) | |||||||||||||||
|
|
||||||||||||||||
| .PHONY: .install.lint | ||||||||||||||||
| .install.lint: | ||||||||||||||||
| case "$$(go env GOVERSION)" in \ | ||||||||||||||||
| go1.18.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.47.3;; \ | ||||||||||||||||
| go1.19.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.54.1;; \ | ||||||||||||||||
| go1.20.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2;; \ | ||||||||||||||||
| go1.21.*) go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.59.1;; \ | ||||||||||||||||
| *) go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest;; \ | ||||||||||||||||
| esac | ||||||||||||||||
| curl -sSfL https://golangci-lint.run/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VER) | ||||||||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the recommended installation method golangci-lint documents, and it says:
https://golangci-lint.run/docs/welcome/install/local/ The version is pinned as If you are concerned about a supply chain attack on the script hosted at golangci-lint.run, maybe we could vendor the script locally? I am not sure that is needed.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Vendoring the script is way more than it's worth, IMO -- I'd be more comfortable ditching golangci-lint entirely (or replicating all the types of checks it does by hand) than The amount of Go code we actually have here is tiny -- can we enumerate what it is we're actually getting from golangci-lint? I'm not certain, but I imagine that we get more value out of aggressively supporting a wide swath of Go versions than we do out of golangci-lint, so if it means we have to drop support for Go versions, I'd rather see us drop it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe something like this?
Suggested change
(honestly baking this into the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is no trade-off to make here: we do not have to drop support for any Go version. The latest golangci-lint is compatible with older
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is a third option besides
https://golangci-lint.run/docs/welcome/install/ci/ The trade-off is that lint would then only run in actions,
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
+1
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
How about we start by migrating the lint part from the makefile to native actions? Or do you want to migrate all makefile targets at once? |
||||||||||||||||
|
|
||||||||||||||||
| .PHONY: .install.gitvalidation | ||||||||||||||||
| .install.gitvalidation: | ||||||||||||||||
|
|
||||||||||||||||
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.
I don't agree with dropping support for all previous versions of Go.
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.
Nothing is dropped,
go.modstill declares 1.18, the CI matrix is unchanged, and the go1.18 job is still running.The only change is that we no longer compile golangci-lint on the fly with the Go environment of the current CI job, and use the prebuilt binary that upstream provides instead.
golangci-lint v1 can no longer analyse under go1.27, so we had to migrate to v2.