Skip to content

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

ofekshenawa
Copy link
Collaborator

@ofekshenawa ofekshenawa commented Apr 20, 2025

  • 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.

@@ -23,5 +23,5 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6.5.2
Copy link
Contributor

@elena-kolevska elena-kolevska Apr 21, 2025

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

Copy link
Member

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.

@ofekshenawa ofekshenawa marked this pull request as ready for review April 23, 2025 20:25
@ofekshenawa ofekshenawa added dependencies Pull requests that update a dependency file maintenance labels Apr 23, 2025
@ofekshenawa ofekshenawa self-assigned this Apr 24, 2025
Copy link
Member

@ndyakov ndyakov left a 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.

Comment on lines -680 to +683
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,
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file maintenance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants