-
Notifications
You must be signed in to change notification settings - Fork 1.5k
no-jira: Golangci config #10372
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
Merged
openshift-merge-bot
merged 2 commits into
openshift:main
from
patrickdillon:golangci-config
Mar 10, 2026
+3
−1
Merged
no-jira: Golangci config #10372
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
🧩 Analysis chain
🌐 Web query:
In golangci-lint v2, does alinters.exclusions.rulesentry with onlylintersandtextexclude matching issues globally? How should it be scoped so it only applies to_test.gofiles?💡 Result:
Yes. In golangci-lint v2, a
linters.exclusions.rulesitem that only specifieslintersandtext(and nopath/path-except) matches all files, so it excludes matching issues “globally” for the selected linters. [1]To scope it to
_test.gofiles, add apathregex that matches test files, e.g.:(
path-exceptis the inverse, i.e., apply the rule everywhere except matching paths.) [1]Sources: [1] [2]
Scope this revive exclusion to
_test.gofiles.This exclusion rule specifies only
lintersandtextwithout apathconstraint, which makes it apply globally to all files. In golangci-lint v2, test-only scoping requires adding apathregex. As written, the rule suppresses this warning in all packages, not just test files, which is broader than the PR objective.Suggested fix
- linters: - revive text: "var-naming: avoid meaningless package names" + - path: _test\.go + linters: + - revive + text: "var-naming: avoid meaningless package names"🤖 Prompt for AI Agents
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.
No, we want to exclude this warning from all packages. This change is correct as intended :D
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.
@tthvo, understood! Thanks for the clarification — suppressingvar-naming: avoid meaningless package namesglobally makes sense since the warning can surface in any package, not just test files. The change is correct as intended. My apologies for the noise!