-
Notifications
You must be signed in to change notification settings - Fork 10.1k
tooling: enforce version of golangci-lint #20205
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?
Conversation
Signed-off-by: sprochazka <s.prochazka6@gmail.com>
Hi @BBQing. Thanks for your PR. I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Signed-off-by: sprochazka <s.prochazka6@gmail.com>
/ok-to-test |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted filessee 34 files with indirect coverage changes @@ Coverage Diff @@
## main #20205 +/- ##
==========================================
- Coverage 69.33% 69.04% -0.30%
==========================================
Files 413 410 -3
Lines 34367 34232 -135
==========================================
- Hits 23827 23634 -193
- Misses 9150 9182 +32
- Partials 1390 1416 +26 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
/test pull-etcd-e2e-amd64 |
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 - Thanks @BBQing
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" "${GOLANGCI_LINT_VERSION}" | ||
} | ||
|
||
GOLANGCI_LINT_VERSION=$(cd tools/mod && go list -m -f '{{.Version}}' github.com/golangci/golangci-lint) |
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 re-created the issue by opening main
in a GitHub codespace (which uses our devcontainer) and I get the same error as described in the linked issue due to the devcontainer having v2.x
of golangci-lint
installed.
Our configuration file for golangci-lint at tools/.golangci.yaml
has not yet been updated to v2.x
format so the error is valid.
At some point we need to migrate formats and update golangci-lint, though in the interim this resolves the broken development environment. There was a previous attempt to update the configuration in #19692 howver the pr was closed, @mmorel-35 do you have capacity to open a fresh pr for this migration?
Given our devcontainer environment is listed as a supported development environment we should merge this quickly. cc @ivanvc for a second review prior to merge.
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.
The issue also impacts development against stable release branches in a codespace / devcontainer.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: BBQing, jmhbnz The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.
fixes #20199
tested against no golangci-lint and latest version installed (I think it matter, if the version is 2 instead of 1)
add into makefile:
latest-golangci-lint:
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOPATH)/bin
vscode ➜ /workspaces/etcd (main) $ make latest-golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b /go/bin
golangci/golangci-lint info checking GitHub for latest tag
golangci/golangci-lint info found version: 2.1.6 for v2.1.6/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
vscode ➜ /workspaces/etcd (main) $ make verify-lint
./scripts/verify_golangci-lint_version.sh
different golangci-lint version installed: v2.1.6
Installing golangci-lint v1.64.8
golangci/golangci-lint info checking GitHub for tag 'v1.64.8'
golangci/golangci-lint info found version: 1.64.8 for v1.64.8/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
golangci-lint version: v1.64.8
PASSES="lint" ./scripts/test.sh
Running with --race
Starting at: Sat Jun 21 12:22:51 PM UTC 2025
'lint' started at Sat Jun 21 12:22:51 PM UTC 2025
% (cd api && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd pkg && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd client/pkg && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd client/v3 && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd server && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd etcdutl && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd etcdctl && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tests && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/mod && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/rw-heatmaps && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/testgrid-analysis && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd cache && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...'
'lint' PASSED and completed at Sat Jun 21 12:22:55 PM UTC 2025
SUCCESS
remove-lint:
rm -rf $(GOPATH)/bin/golangci-lint
vscode ➜ /workspaces/etcd (main) $ make remove-lint
rm -rf /go/bin/golangci-lint
vscode ➜ /workspaces/etcd (main) $ make verify-lint
./scripts/verify_golangci-lint_version.sh
golangci-lint is not available
Installing golangci-lint v1.64.8
golangci/golangci-lint info checking GitHub for tag 'v1.64.8'
golangci/golangci-lint info found version: 1.64.8 for v1.64.8/linux/amd64
golangci/golangci-lint info installed /go/bin/golangci-lint
PASSES="lint" ./scripts/test.sh
Running with --race
Starting at: Sat Jun 21 12:24:43 PM UTC 2025
'lint' started at Sat Jun 21 12:24:43 PM UTC 2025
% (cd api && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd pkg && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd client/pkg && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd client/v3 && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd server && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd etcdutl && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd etcdctl && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tests && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/mod && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/rw-heatmaps && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd tools/testgrid-analysis && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% (cd cache && 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...')
% 'golangci-lint' 'run' '--config' '/workspaces/etcd/tools/.golangci.yaml' './...'
'lint' PASSED and completed at Sat Jun 21 12:24:46 PM UTC 2025
SUCCESS
vscode ➜ /workspaces/etcd (fix_verify_lint) $ make verify-shellcheck
PASSES="shellcheck" ./scripts/test.sh
Running with --race
Starting at: Mon Jun 23 12:54:40 PM UTC 2025
'shellcheck' started at Mon Jun 23 12:54:40 PM UTC 2025
Tool: 'shellcheck' not found on PATH. https://github.com/koalaman/shellcheck#installing
Installing shellcheck v0.10.0
shellcheck-v0.10.0/LICENSE.txt
shellcheck-v0.10.0/README.txt
shellcheck-v0.10.0/shellcheck
% './bin/shellcheck' '-fgcc' 'scripts/build-binary.sh' 'scripts/build-docker.sh' 'scripts/build_lib.sh' 'scripts/build-release.sh' 'scripts/build.sh' 'scripts/build_tools.sh' 'scripts/codecov_upload.sh' 'scripts/fix.sh' 'scripts/fuzzing.sh' 'scripts/genproto.sh' 'scripts/markdown_diff_lint.sh' 'scripts/measure-testgrid-flakiness.sh' 'scripts/release_mod.sh' 'scripts/release.sh' 'scripts/sync_go_toolchain_directive.sh' 'scripts/test_images.sh' 'scripts/test_lib.sh' 'scripts/test.sh' 'scripts/test_utils.sh' 'scripts/updatebom.sh' 'scripts/update_dep.sh' 'scripts/update_proto_annotations.sh' 'scripts/verify_genproto.sh' 'scripts/verify_golangci-lint_version.sh' 'scripts/verify_go_versions.sh' 'scripts/verify_proto_annotations.sh'
'shellcheck' PASSED and completed at Mon Jun 23 12:54:45 PM UTC 2025
SUCCESS