Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .golangci-lint-v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ linters:
- importas
- misspell
- nakedret
- prealloc
- predeclared
- revive
- staticcheck
Expand Down Expand Up @@ -88,6 +87,9 @@ linters:
- linters:
- goconst
path: _test\.go
- linters:
- revive
text: "var-naming: avoid meaningless package names"
Comment on lines +90 to +92
Copy link

@coderabbitai coderabbitai bot Mar 9, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🌐 Web query:

In golangci-lint v2, does a linters.exclusions.rulesentry with onlylintersandtextexclude matching issues globally? How should it be scoped so it only applies to_test.go files?

💡 Result:

Yes. In golangci-lint v2, a linters.exclusions.rules item that only specifies linters and text (and no path / path-except) matches all files, so it excludes matching issues “globally” for the selected linters. [1]

To scope it to _test.go files, add a path regex that matches test files, e.g.:

linters:
  exclusions:
    rules:
      - path: '(.+)_test\.go'
        linters: [mnd]          # your linter(s)
        text: "Magic number: 9" # your match text/regex

(path-except is the inverse, i.e., apply the rule everywhere except matching paths.) [1]

Sources: [1] [2]


Scope this revive exclusion to _test.go files.

This exclusion rule specifies only linters and text without a path constraint, which makes it apply globally to all files. In golangci-lint v2, test-only scoping requires adding a path regex. 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
Verify each finding against the current code and only fix it if needed.

In @.golangci-lint-v2.yaml around lines 90 - 92, The revive exclusion currently
listed (linters: revive, text: "var-naming: avoid meaningless package names") is
global; scope it to test files by adding a path regex that matches _test.go
files (e.g. path: '.*_test\.go$') so the suppression only applies to test-only
files; update the exclusion block containing the revive rule to include that
path field while keeping the existing linters and text entries.

Copy link
Member

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

Copy link

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 — suppressing var-naming: avoid meaningless package names globally 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!


📝 Learnings were identified and not saved (knowledge base disabled). Enable

paths:
- ^bin
- ^cluster-api
Expand Down