-
Notifications
You must be signed in to change notification settings - Fork 2.4k
migrate golangci-lint config to v2 format #3354
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: master
Are you sure you want to change the base?
Conversation
ofekshenawa
commented
Apr 20, 2025
•
edited
Loading
edited
- bump config schema to version “2”
- re‑add 5m timeout under run
- enable config verification in GitHub Action (verify: true)
- Address several golangci-lint/staticcheck warnings:
-
- Use a tagged switch instead of an if/else if chain on readType
-
- Drop redundant embedded-field selectors (baseCmd.* and baseClient.*) in favor of direct calls.
.github/workflows/golangci-lint.yml
Outdated
@@ -23,5 +23,5 @@ jobs: | |||
- name: golangci-lint | |||
uses: golangci/golangci-lint-action@v6.5.2 |
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.
Feel free to update the version as well and close #3328
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.
@ofekshenawa I agree with @elena-kolevska. We can simply update the version in this PR. My initial idea was to update the config in #3328 , but since this is already done here, let's just update the version.
…grate-golang-ci-to-new-version-format
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.
Let's work on setting up the staticcheck
in such a way that it won't require us to sacrifice on readability just to lint the code.
dial: c.baseClient.dial, | ||
process: c.baseClient.process, | ||
pipeline: c.baseClient.processPipeline, | ||
txPipeline: c.baseClient.processTxPipeline, | ||
dial: c.dial, | ||
process: c.process, | ||
pipeline: c.processPipeline, | ||
txPipeline: c.processTxPipeline, |
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 think having the embedded field here (baseClient
) makes it easier to follow the logic and it is more clear what is happening in the client. Let's alter the linters in such a way, to allow us to have the embedded fields in the selectors. I did try different settings for the staticcheck
linter and found the following to my liking:
staticcheck:
checks:
- all
# Incorrect or missing package comment.
# https://staticcheck.dev/docs/checks/#ST1000
- -ST1000
# Omit embedded fields from selector expression.
# https://staticcheck.dev/docs/checks/#QF1008
- -QF1008
You can try by adding those in a section settings:
in the linters:
section of the .golangci.yml
. Let me know what you think.