Skip to content

build: migrate to golangci-lint v2 - #3983

Open
sebrandon1 wants to merge 1 commit into
operator-framework:masterfrom
sebrandon1:migrate-golangci-lint-v2
Open

sebrandon1 wants to merge 1 commit into
operator-framework:masterfrom
sebrandon1:migrate-golangci-lint-v2

Conversation

@sebrandon1

@sebrandon1 sebrandon1 commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Move the lint tool pin from golangci-lint v1.64.8 — the last release of the EOL v1 line — to v2.15.0. v2 lives on a separate module path (github.com/golangci/golangci-lint/v2), so Dependabot never proposed it and the pin has sat on v1 since the tool moved into go.mod in build: run pinned tools with go tool #3962
  • Convert .golangci.yaml to the v2 schema with golangci-lint migrate, then switch off the new QF quickfix checks (QF1001/1004/1006/1008, 54 findings against long-unchanged code) and exclude nine newly-reported SA1019 deprecations (Requeue, ListFunc/WatchFunc, SelfLink) — migrating those is a behaviour change, not a rename, so they are tracked separately
  • make lint is a required CI job (sanity.yaml → static-analysis), so the tool pin and the config change have to land in the same commit
  • Only .golangci.yaml, go.mod and go.sum change outside vendor/ (2,477 of the 2,480 files); review with -path:vendor

Jira

  • CNF-30663 — operator-lifecycle-manager: Migrate to golangci-lint v2 (Code Review)
  • Epic: CNF-26078

Test Plan

  • CI passes: static-analysis (make lint vet), check-vendor, verify, unit, build
  • go tool golangci-lint --version reports v2.15.0, built with go1.26.3 to match the go directive
  • make lint reports 0 issues — no source files change, so lint output is unchanged apart from the exclusions listed above

Summary by CodeRabbit

  • Chores
    • Updated development tooling and supporting dependencies. Automated code checks now use refreshed formatting and static-analysis settings, with updated rules for reported issues.
    • No changes to app features or behavior are included in this update.

@openshift-ci openshift-ci Bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 2, 2026
@openshift-ci

openshift-ci Bot commented Dec 2, 2026

Copy link
Copy Markdown

Hi @sebrandon1. Thanks for your PR.

I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

Explain Change →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The lint tool dependency and configuration move to golangci-lint v2. The configuration updates enabled linters, formatters, import aliases, and exclusions. The module file updates indirect dependencies used by linting and analysis tools.

Changes: golangci-lint v2 migration

Layer / File(s) Summary
Update lint tool dependencies
go.mod
The tool module path changes to golangci-lint v2. The module file adds, updates, and removes indirect dependencies for linting and analysis tools.
Migrate lint configuration
.golangci.yaml
The configuration adopts the v2 schema. It updates linter and formatter settings, import aliases, exclusions, and the staticcheck rule for matching SA1019 reports.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: tmshort

Merge Risk: Minimal · previous review 08b56 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "build: migrate to golangci-lint v2" matches the main change. The raw summary shows .golangci.yaml converted to the v2 schema and go.mod moving the golangci-lint tool pin from v1 to v2. The …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "build: migrate to golangci-lint v2" matches the main change. The raw summary shows .golangci.yaml converted to the v2 schema and go.mod moving the golangci-lint tool pin from v1 to v2. The PR objectives confirm the migration from v1.64.8 to v2.15.0. The title is short, single-sentence, and uses a conventional commit prefix. It does not mention the lint rule exclusions or deprecation suppressions, which is an acceptable omission.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@sebrandon1 sebrandon1 changed the title CNF-30663: build: migrate to golangci-lint v2 build: migrate to golangci-lint v2 Dec 2, 2026
@sebrandon1
sebrandon1 force-pushed the migrate-golangci-lint-v2 branch from 9511884 to 08b5643 Compare December 2, 2026 23:30
@tmshort

tmshort commented Dec 3, 2026

Copy link
Copy Markdown
Member

/approve
(did not look at vendor, but the 3 edited files look ok)

@tmshort

tmshort commented Dec 3, 2026

Copy link
Copy Markdown
Member

/ok-to-test

@openshift-ci openshift-ci Bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 3, 2026
The golangci-lint v1 line is end of life, and v1.64.8 cannot read the v2
configuration format. Move the tool pin to the v2 module path and take
the current release (v1.64.8 -> v2.15.0).

The configuration is produced by `golangci-lint migrate` and then
adjusted in two places:

- staticcheck absorbed stylecheck in v2 and now also runs the stylistic
  QF quickfix checks. QF1001/1004/1006/1008 are switched off so the tool
  bump does not become a repo-wide refactor.
- The newer staticcheck flags deprecations the v1 pin did not know about
  (Requeue, ListWatch.ListFunc/WatchFunc, SelfLink). Fixing those is a
  behaviour change - RequeueAfter is not a drop-in for Requeue, and the
  list/watch callbacks need context plumbing - so they are excluded with
  a comment rather than silently ignored.

`make lint` reported 0 issues before and after the change.

Signed-off-by: Brandon Palm <bpalm@redhat.com>
@sebrandon1
sebrandon1 force-pushed the migrate-golangci-lint-v2 branch from 08b5643 to 205ab73 Compare December 4, 2026 14:20
@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 4, 2026
@openshift-ci

openshift-ci Bot commented Dec 4, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tmshort

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants