-
Notifications
You must be signed in to change notification settings - Fork 86
chore: Migrate repository to golangci-lint v2 #811
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
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,19 +1,30 @@ | ||
| version: "2" | ||
| run: | ||
| # Our CI expects a vendor directory, hence we have to use -mod=readonly here as well. | ||
| modules-download-mode: readonly | ||
| deadline: 30m | ||
| timeout: 5m | ||
|
|
||
| # default linters are enabled `golangci-lint help linters` | ||
| linters: | ||
| disable-all: true | ||
| default: none | ||
| enable: | ||
| - errcheck | ||
| - gosec | ||
| - gosimple | ||
| - govet | ||
| - ineffassign | ||
| - staticcheck | ||
| - typecheck | ||
| - unused | ||
| - stylecheck | ||
| - errcheck | ||
| - gosec | ||
| - govet | ||
| - ineffassign | ||
| - staticcheck | ||
| - unused | ||
| exclusions: | ||
| generated: lax | ||
| presets: | ||
| - comments | ||
| - common-false-positives | ||
| - legacy | ||
| - std-error-handling | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| formatters: | ||
| exclusions: | ||
| generated: lax | ||
| paths: | ||
| - third_party$ | ||
| - builtin$ | ||
| - examples$ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ GO_BUILD_FLAGS :=-tags 'include_gcs include_oss containers_image_openpgp gssapi' | |
| GO_BUILD_FLAGS_DARWIN :=-tags 'include_gcs include_oss containers_image_openpgp' | ||
| GO_BUILD_FLAGS_LINUX_CROSS :=-tags 'include_gcs include_oss containers_image_openpgp' | ||
|
|
||
| GOLANGCI_LINT_VERSION=v1.61.0 | ||
| GOLANGCI_LINT_VERSION=v2.5.0 | ||
| GORELEASER_VERSION=v1.14.1 | ||
| GOVULNCHECK_VERSION=v1.0.1 | ||
|
|
||
|
|
@@ -66,8 +66,8 @@ test-in-container: build-image | |
| # Installed using instructions from: https://golangci-lint.run/usage/install/#linux-and-windows | ||
| getlint: | ||
| @mkdir -p $(GOPATH)/bin | ||
| @ls $(GOPATH)/bin/golangci-lint 1>/dev/null || (echo "Installing golangci-lint..." && curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION)) | ||
|
Contributor
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. Could you elaborate on why we are removing the
Member
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. The main reason for the change here is to ensure |
||
|
|
||
| @echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)..." | ||
| curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_LINT_VERSION) | ||
| .PHONY: lint | ||
| lint: getlint | ||
| $(GOPATH)/bin/golangci-lint run --timeout 5m | ||
|
|
@@ -128,7 +128,7 @@ mock-gen: | |
|
|
||
| .PHONY: build-image | ||
| build-image: | ||
| $(CONTAINER_ENGINE) build --pull --platform linux/amd64 --build-arg=GOLANGCI_LINT_VERSION -t backplane-cli-builder -f ./make.Dockerfile . | ||
| $(CONTAINER_ENGINE) build --pull --platform linux/amd64 --build-arg GOLANGCI_LINT_VERSION=$(GOLANGCI_LINT_VERSION) -t backplane-cli-builder -f ./make.Dockerfile . | ||
|
|
||
| .PHONY: lint-in-container | ||
| lint-in-container: build-image | ||
|
|
||
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.
It seems we are removing
stylecheck. Is v2 not supporting this or any other reason?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.
Yep,
stylecheckhas been merged intostaticcheck🙂 (also a few others) source: https://golangci-lint.run/docs/product/migration-guide/#lintersenablestylecheckgosimplestaticcheck