chore: Migrate repository to golangci-lint v2#811
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #811 +/- ##
==========================================
+ Coverage 52.83% 53.24% +0.40%
==========================================
Files 86 86
Lines 6420 6491 +71
==========================================
+ Hits 3392 3456 +64
- Misses 2577 2581 +4
- Partials 451 454 +3
🚀 New features to boost your workflow:
|
5c041d0 to
4b254c9
Compare
4b254c9 to
8f9b39d
Compare
| - staticcheck | ||
| - typecheck | ||
| - unused | ||
| - stylecheck |
There was a problem hiding this comment.
It seems we are removing stylecheck. Is v2 not supporting this or any other reason?
There was a problem hiding this comment.
Yep, stylecheck has been merged into staticcheck 🙂 (also a few others) source: https://golangci-lint.run/docs/product/migration-guide/#lintersenablestylecheckgosimplestaticcheck
| # 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)) |
There was a problem hiding this comment.
Could you elaborate on why we are removing the ls check here?
There was a problem hiding this comment.
The main reason for the change here is to ensure golangci-lint is reinstalled properly each time, I think ls itself wouldn't be an issue but our CI did keep failing until I forced it to overwrite the existing installation to ensure the latest version is installed.
|
@MateSaary thank you for the PR to improve the code quality! I left 2 comments inline regarding the changes on the lint config and makefile, could you help to elaborate on them? Notes to other reviewers: don't be scared by the number of files changed, they are mostly add a |
|
@feichashao thank you for the review and comments, hopefully my responses help answer your questions 🙂 Let me know if there's any further questions or clarification needed! |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: feichashao, MateSaary The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@MateSaary: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
What type of PR is this?
What this PR does / Why we need it?
This PR migrates
golangci-lintfrom version 1.61 to the latest, 2.5. Due to the stricter linting introduced (particularly with errcheck), quite a few updates to existing code was needed.Not sure if we generally like this change appearance/readability wise but it does make code more semantically correct/less bug-prone, happy to discuss.
Which Jira/Github issue(s) does this PR fix?
Special notes for your reviewer
Unit Test Coverage
Guidelines
Test coverage checks
Pre-checks (if applicable)
/label tide/merge-method-squash