Skip to content

Upgrade golangci-lint from v1 to v2#90

Open
sebrandon1 wants to merge 1 commit intoopenshift:mainfrom
sebrandon1:golangci-lint-v2-upgrade
Open

Upgrade golangci-lint from v1 to v2#90
sebrandon1 wants to merge 1 commit intoopenshift:mainfrom
sebrandon1:golangci-lint-v2-upgrade

Conversation

@sebrandon1
Copy link
Member

Summary

  • Update golangci-lint from v1.59.1 to v2.0.2
  • Update module path to use /v2/ prefix
  • Migrate .golangci.yml to v2 format
  • Remove deprecated exportloopref linter (fixed in Go 1.22+)

Changes Made

  • Makefile: Updated version variable and module path
  • .golangci.yml: Converted to v2 format with proper structure

Test plan

  • CI linting passes with golangci-lint v2
  • No new linting errors introduced

Tracking: redhat-best-practices-for-k8s/telco-bot#49

@coderabbitai
Copy link

coderabbitai bot commented Jan 16, 2026

Walkthrough

This PR bumps golangci-lint to v2.0.2 and changes its install method in the Makefile; it also restructures .golangci.yml (renaming/reparenting settings, adding a formatters section, relocating issues/exclude rules) without changing linter rule semantics.

Changes

Cohort / File(s) Summary
Makefile (golangci-lint install/version)
Makefile
Bumped GOLANGCI_LINT_VERSION to v2.0.2 and replaced the previous go install-style installation with a curl-based installer invocation that installs the v2 binary into ./bin. Review install flow and target idempotency.
GolangCI configuration restructure
.golangci.yml
Reordered top-level blocks: introduced version: "2", moved/renamed linters-settingssettings, created a separate formatters section (enabling gofmt, goimports), removed exportloopref from enabled linters, and relocated issues/exclude-rules. Linter rule mappings (e.g., api/* with lll, pkg/* with dupl/lll) preserved; verify settings namespace changes (e.g., revive) and formatting behavior.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes


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

@openshift-ci
Copy link

openshift-ci bot commented Jan 16, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sebrandon1
Once this PR has been reviewed and has the lgtm label, please assign bharath-b-rh for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

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: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.golangci.yml (1)

1-47: Fix v1 incompatibility in linters configuration.

golangci-lint v2 removed the top-level disable-all property. Replace line 7 with:

  default: none

In v2, use linters.default: none (or all/standard/fast) instead of the deprecated v1 disable-all: true flag. This will ensure the configuration works correctly in v2.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to data retention organization setting

Knowledge base: Disabled due to Reviews -> Disable Knowledge Base setting

📥 Commits

Reviewing files that changed from the base of the PR and between fd0900b and 71d0de9.

📒 Files selected for processing (2)
  • .golangci.yml
  • Makefile
🧰 Additional context used
📓 Path-based instructions (1)
**

⚙️ CodeRabbit configuration file

-Focus on major issues impacting performance, readability, maintainability and security. Avoid nitpicks and avoid verbosity.

Files:

  • Makefile
🔇 Additional comments (1)
Makefile (1)

233-233: Version and module path updates are consistent with golangci-lint v2.

The version bump to v2.0.2 and the /v2/ module path prefix in the go-install-tool invocation align correctly with Go module versioning requirements for major version 2+.

Also applies to: 253-253

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

- Update GOLANGCI_LINT_VERSION from v1.59.1 to v2.0.2
- Update module path to use /v2/ prefix
- Migrate .golangci.yml to v2 format:
  - Add version: "2" declaration
  - Move linters-settings under linters.settings
  - Move formatters (gofmt, goimports) to formatters.enable
  - Remove deprecated exportloopref linter (fixed in Go 1.22+)

Tracking: redhat-best-practices-for-k8s/telco-bot#49
@sebrandon1 sebrandon1 force-pushed the golangci-lint-v2-upgrade branch from 71d0de9 to 633789a Compare January 16, 2026 20:02
@openshift-ci
Copy link

openshift-ci bot commented Jan 16, 2026

@sebrandon1: all tests passed!

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

Copy link
Contributor

@anirudhAgniRedhat anirudhAgniRedhat left a comment

Choose a reason for hiding this comment

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

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jan 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants