-
Notifications
You must be signed in to change notification settings - Fork 2.8k
chore(lint): configure goconst linter #5929
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
chore(lint): configure goconst linter #5929
Conversation
Enable goconst linter with min-occurrences threshold of 3 and exclude
well-known protocol values that don't need constants:
- DNS record types (A, AAAA, CNAME, TXT, etc.)
- Boolean strings ("true", "false")
- Common null indicators ("none")
- Registry types (aws-sd, noop)
This catches genuinely problematic string repetitions while avoiding
over-engineering for standard protocol values.
Co-Authored-By: Claude <[email protected]>
|
Hi @lexfrei. Thanks for your PR. I'm waiting for a github.com 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. |
|
/ok-to-test |
Pull Request Test Coverage Report for Build 18958949696Details
💛 - Coveralls |
Update all linter documentation references from deprecated /usage/ paths to current /docs/ paths. Fix errorlint anchor from #errcheck to #errorlint. Co-Authored-By: Claude <[email protected]>
|
/lgtm |
mloiseleur
left a comment
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.
thanks @lexfrei 👍
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mloiseleur 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 |
What does it do?
Enables and configures the
goconstlinter in golangci-lint to detect repeated string literals that should be constants, while excluding well-known protocol values that don't benefit from being constants.Motivation
Following up on the discussion started in #5889, this PR enables the
goconstlinter with appropriate configuration.The linter is configured to catch genuinely problematic string repetitions (3+ occurrences) while avoiding noise from values that shouldn't become constants:
controller/execute.gopackage to use constants consistently for all provider and registry types, which would significantly reduce readability by mixing string literals and constants in switch statementsSetting
min-occurrences: 3ensures we catch project-specific strings that genuinely need constants while avoiding over-engineering for well-known values.More