Skip to content

add golangci-lint to pipeline#234

Merged
f-leu merged 5 commits intomainfrom
PC-471
Jan 8, 2026
Merged

add golangci-lint to pipeline#234
f-leu merged 5 commits intomainfrom
PC-471

Conversation

@f-leu
Copy link
Contributor

@f-leu f-leu commented Jan 8, 2026

[Title]

📚 Description of Changes

Provide an overview of your changes and why they’re needed. Link to any related issues (e.g., "Fixes #123"). If your PR fixes a bug, resolves a feature request, or updates documentation, please explain how.

  • What Changed:
    (Describe the modifications, additions, or removals.)

  • Why This Change:
    (Explain the problem this PR addresses or the improvement it provides.)

  • Affected Components:
    (Which component does this change affect? - put x for all components)

  • Compose

  • K8s

  • Other (please specify)

❓ Motivation and Context

Why is this change required? What problem does it solve?

  • Context:
    (Provide background information or link to related discussions/issues.)

  • Relevant Tasks/Issues:
    (e.g., Fixes: #GitHub Issue)

🔍 Types of Changes

Indicate which type of changes your code introduces (check all that apply):

  • BUGFIX: Non-breaking fix for an issue.
  • NEW FEATURE: Non-breaking addition of functionality.
  • BREAKING CHANGE: Fix or feature that causes existing functionality to not work as expected.
  • ENHANCEMENT: Improvement to existing functionality.
  • CHORE: Changes that do not affect production (e.g., documentation, build tooling, CI).

🔬 QA / Verification Steps

Describe the steps a reviewer should take to verify your changes:

  1. (Step one: e.g., "Run make test to verify all tests pass.")
  2. (Step two: e.g., "Deploy to a Kind cluster with make create-kind && make deploy.")
  3. (Additional steps as needed.)

✅ Global Checklist

Please check all boxes that apply:

  • I have read and followed the CONTRIBUTING guidelines.
  • My code follows the code style of this project.
  • I have updated the documentation as needed.
  • I have added tests that cover my changes.
  • All new and existing tests have passed locally.
  • I have run this code in a local environment to verify functionality.
  • I have considered the security implications of this change.

Summary by CodeRabbit

  • Documentation

    • Enhanced contributor guide with a comprehensive linting section, local run instructions, configuration details, and best practices.
  • Chores

    • Added an automated golangci-lint workflow to CI.
    • Updated lint configuration to adjust enabled linters.
    • Bumped the default golangci-lint version used by project tooling.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Warning

Rate limit exceeded

@f-leu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 5 minutes and 4 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between a1ac000 and 8cff935.

📒 Files selected for processing (1)
  • .github/workflows/golangci-lint.yml
📝 Walkthrough

Walkthrough

Adds linting infrastructure: a new GitHub Actions workflow to run golangci-lint, contributor guide documentation for linting, a .golangci.yml tweak (removes exportloopref), and updates the Makefile default golangci-lint version.

Changes

Cohort / File(s) Summary
Documentation
\.github/CONTRIBUTING\.md
Adds a Linting section (TOC entry and full guidance) describing golangci-lint usage, local commands, configuration and best practices; duplicate subsection present under Testing.
CI / GitHub Actions
\.github/workflows/golang-lint\.yml
New workflow to run golangci-lint on push to main, PRs, merge_group, and workflow_dispatch; sets Go from go.mod, runs make generate, installs golangci-lint (pins v1.62.2) and uses only-new-issues for PRs.
Linter config
\.golangci\.yml
Removes exportloopref from enabled linters.
Build tooling
Makefile
Updates default GOLANGCI_LINT_VERSION from v1.59.1 to v1.62.2.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer (push/PR)
    participant GH as GitHub Actions
    participant Go as Go toolchain / repo
    participant Lint as golangci-lint action

    Dev->>GH: push / open PR / manual dispatch
    GH->>Go: checkout repo, read go.mod, setup Go, cache deps
    GH->>Go: run `make generate`
    GH->>Lint: install pinned golangci-lint, run linters (only-new-issues for PR)
    Lint->>GH: report results (annotations, success/failure)
    GH->>Dev: display status, annotations on PR
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • dray92

Poem

🐰 I hop through CI with a careful eye,
Checking each line as commits go by.
A tidy rulebook, and a linting song—
Together we keep the codebase strong! 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The linked issue #123 is about cluster snapshot enum name fix, which is unrelated to adding golangci-lint to the pipeline. Verify that the correct issue is linked. The current issue #123 appears to be unrelated to the golangci-lint CI pipeline changes.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add golangci-lint to pipeline' directly and accurately summarizes the main change—introducing golangci-lint to the CI pipeline via new workflow file.
Out of Scope Changes check ✅ Passed All changes (workflow file, documentation, configuration, version update) are directly related to implementing golangci-lint in the CI pipeline.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In @.github/workflows/golang-lint.yml:
- Around line 29-36: The workflow step that runs golangci-lint currently sets
only-new-issues: true unconditionally; change it so the step or the
only-new-issues input is only enabled for pull requests (e.g., use a GitHub
Actions condition like if: github.event_name == 'pull_request' on the "Run
golangci-lint" step or set only-new-issues only when github.event_name ==
'pull_request') so that pushes to main run the full lint report while PRs still
show only new issues.
- Around line 23-27: Update the GitHub Actions workflow steps that call
actions/setup-go@v5 to use Go 1.24 instead of 1.22: change the go-version value
under the "Set up Go" step in .github/workflows/golang-lint.yml and make the
same update in build-installer-check.yml, k8s-compatibility-test.yml,
metrics-server-lifecycle-test.yml, and run-tests.yml so the workflows match the
module's declared go 1.24 in go.mod.
- Line 32: The workflow pins golangci-lint to an outdated release (version
string "v1.59.1"); update that pinned version to "v2.7.2" in the workflow
(replace the existing version value in the golangci-lint step) so the action
uses the latest stable v2 release.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a7fcb1 and 431f6e6.

📒 Files selected for processing (3)
  • .github/CONTRIBUTING.md
  • .github/workflows/golang-lint.yml
  • .golangci.yml
💤 Files with no reviewable changes (1)
  • .golangci.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build Docker Image
  • GitHub Check: Build Docker Image
  • GitHub Check: Analyze (go)
🔇 Additional comments (4)
.github/CONTRIBUTING.md (2)

17-17: LGTM!

The TOC entry is correctly formatted and properly links to the new Linting section.


74-106: The documentation is accurate and matches the actual configuration. All referenced make targets exist in the Makefile and all listed linters are enabled in .golangci.yml. The note about additional linters being available in the configuration file is correct.

.github/workflows/golang-lint.yml (2)

1-9: LGTM!

The workflow triggers are appropriate, covering pushes to main, pull requests, merge groups, and manual dispatch.


11-13: LGTM!

Permissions follow the principle of least privilege, granting only read access as needed for a linting workflow.

Comment on lines 29 to 36
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --timeout=5m
# Use the existing .golangci.yml configuration
# Show only new issues for PRs
only-new-issues: true
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Reconsider only-new-issues for main branch pushes.

Setting only-new-issues: true unconditionally means that when code is pushed to main, existing lint issues will not be reported. This could allow technical debt to accumulate, as issues that slip through PR reviews will never be caught on the main branch.

Consider using conditional logic to enable only-new-issues only for pull requests:

🔧 Suggested conditional configuration
       - name: Run golangci-lint
         uses: golangci/golangci-lint-action@v6
         with:
           version: v1.59.1
           args: --timeout=5m
           # Use the existing .golangci.yml configuration
           # Show only new issues for PRs
-          only-new-issues: true
+          only-new-issues: ${{ github.event_name == 'pull_request' }}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --timeout=5m
# Use the existing .golangci.yml configuration
# Show only new issues for PRs
only-new-issues: true
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
args: --timeout=5m
# Use the existing .golangci.yml configuration
# Show only new issues for PRs
only-new-issues: ${{ github.event_name == 'pull_request' }}
🤖 Prompt for AI Agents
In @.github/workflows/golang-lint.yml around lines 29 - 36, The workflow step
that runs golangci-lint currently sets only-new-issues: true unconditionally;
change it so the step or the only-new-issues input is only enabled for pull
requests (e.g., use a GitHub Actions condition like if: github.event_name ==
'pull_request' on the "Run golangci-lint" step or set only-new-issues only when
github.event_name == 'pull_request') so that pushes to main run the full lint
report while PRs still show only new issues.

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59.1
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

latest stable version of golangci-lint January 2026

💡 Result:

The latest stable golangci-lint release as of January 8, 2026 is v2.7.2 (released December 7, 2025). [1][2]

Sources:
[1] golangci-lint changelog (v2) — release v2.7.2.
[2] mise-versions listing for golangci-lint (shows v2.7.2).


Update golangci-lint to the latest version.

The workflow pins golangci-lint to v1.59.1, which is significantly outdated. As of January 2026, the latest stable version is v2.7.2 (released December 7, 2025). The major version jump from v1 to v2 indicates substantial improvements, bug fixes, and enhanced linting capabilities. Update to v2.7.2 to benefit from the latest features and security improvements.

🤖 Prompt for AI Agents
In @.github/workflows/golang-lint.yml at line 32, The workflow pins
golangci-lint to an outdated release (version string "v1.59.1"); update that
pinned version to "v2.7.2" in the workflow (replace the existing version value
in the golangci-lint step) so the action uses the latest stable v2 release.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @Makefile:
- Line 519: Update the GOLANGCI_LINT_VERSION variable to v1.64.2 (or newer) so
the Makefile uses a golangci-lint binary built with Go 1.24 support;
specifically change the GOLANGCI_LINT_VERSION definition (symbol
GOLANGCI_LINT_VERSION) from v1.62.2 to v1.64.2 or later and ensure any place
that consumes this variable (e.g., targets that download or install
golangci-lint) will pick up the new version.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 431f6e6 and a1ac000.

📒 Files selected for processing (2)
  • .github/workflows/golang-lint.yml
  • Makefile
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/golang-lint.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: golangci-lint
  • GitHub Check: Build Docker Image
  • GitHub Check: Build Docker Image
  • GitHub Check: Analyze (go)

CONTROLLER_TOOLS_VERSION ?= v0.16.5
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.59.1
GOLANGCI_LINT_VERSION ?= v1.62.2
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

golangci-lint v1.62.2 release

💡 Result:

golangci-lint v1.62.2 was released on 2024-11-25. Changes: several linter dependency bumps (fatcontext, ginkgolinter, errorlint, iface, revive, testifylint) and a fix to ignore cache error when file not found. [1][2]

Sources:
[1] Golangci-lint changelog (v1.62.2).
[2] NewReleases summary of GitHub release v1.62.2.


🌐 Web query:

golangci-lint Go 1.24 compatibility requirements

💡 Result:

Short answer

  • golangci-lint must be built with a Go toolchain at least as new as the Go language version you want to analyze. In other words, a golangci-lint binary built with Go 1.24 (or newer) is required to fully support projects targeting Go 1.24. [1][2]

What to do

  • Use an official golangci-lint release that was compiled with Go 1.24 (support was added in v1.64.2). [2]
  • Or build golangci-lint yourself with Go 1.24 (go build).
  • If you run a binary built with an older Go (e.g., go1.23), you may get errors like "the Go language version (go1.23) used to build golangci-lint is lower than the targeted Go version (1.24.0)". [3]

Sources

  • golangci-lint FAQ: supported Go versions (supports <= Go version used to compile it). [1]
  • golangci-lint changelog v1 (v1.64.2 added go1.24 support). [2]
  • Example issue showing the mismatch error and recommendation to use a golangci-lint version >= the one built with Go 1.24. [3]

Bump golangci-lint to v1.64.2 or newer for Go 1.24 support.

v1.62.2 does not support Go 1.24. golangci-lint must be built with a Go version at least as new as the target Go version. v1.64.2 is the first version compiled with Go 1.24 support; using v1.62.2 will fail with "the Go language version used to build golangci-lint is lower than the targeted Go version (1.24.0)".

🤖 Prompt for AI Agents
In @Makefile at line 519, Update the GOLANGCI_LINT_VERSION variable to v1.64.2
(or newer) so the Makefile uses a golangci-lint binary built with Go 1.24
support; specifically change the GOLANGCI_LINT_VERSION definition (symbol
GOLANGCI_LINT_VERSION) from v1.62.2 to v1.64.2 or later and ensure any place
that consumes this variable (e.g., targets that download or install
golangci-lint) will pick up the new version.

@f-leu f-leu merged commit b62a6f3 into main Jan 8, 2026
26 checks passed
@f-leu f-leu deleted the PC-471 branch January 8, 2026 20:55
@coderabbitai coderabbitai bot mentioned this pull request Jan 9, 2026
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants