Skip to content

Conversation

@kaovilai
Copy link
Member

@kaovilai kaovilai commented Jan 19, 2026

  • bump to latest v1 linter prep for v2
  • updated lint to v2.1.2

Why the changes were made

Fixes #1970 (comment)

CP #1721

How to test the changes made

Fixes openshift#1719 upgrade to latest v1 linter which support go1.23

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
run bin/golang-ci-lint migrate

v2 linter configuration
Fixes openshift#1713

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
Copilot AI review requested due to automatic review settings January 19, 2026 14:11
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 19, 2026

Important

Review skipped

Auto reviews are limited based on label configuration.

🚫 Review skipped — only excluded labels are configured. (1)
  • do-not-merge/work-in-progress

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

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


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

@openshift-ci
Copy link

openshift-ci bot commented Jan 19, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kaovilai

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request attempts to upgrade golangci-lint from v1.55.2 to v2.1.2 and migrate the configuration to a supposed v2 format. However, there are critical issues with this upgrade as golangci-lint v2.x does not exist.

Changes:

  • Updated GOLANGCI_LINT_VERSION from v1.55.2 to v2.1.2 in Makefile
  • Modified golangci-lint installation logic with version checking
  • Restructured .golangci.yaml configuration file with new format and removed many essential linters

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.

File Description
Makefile Updated golangci-lint version to v2.1.2 and changed module path to include /v2, added version check logic before installation
.golangci.yaml Restructured configuration with version field, moved settings under nested structure, removed critical linters, added formatters section

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

linters:
disable-all: true
# TODO enable commented ones
default: none
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The 'linters.default' field is set to 'none', which is not a standard configuration option in golangci-lint v1.x. To disable all linters by default and only enable specific ones, use 'linters.disable-all: true' instead. The current configuration may not work as expected.

Suggested change
default: none
disable-all: true

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +66
settings:
dogsled:
max-blank-identifiers: 2
errcheck:
check-type-assertions: true
check-blank: true
goconst:
min-len: 3
min-occurrences: 5
goheader:
template: |-
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
govet:
enable-all: true
misspell:
locale: US
nakedret:
max-func-lines: 30
nolintlint:
require-explanation: true
require-specific: true
allow-unused: false
revive:
rules:
- name: line-length-limit
disabled: true
- name: blank-imports
- name: dot-imports
- name: duplicated-imports
- name: import-alias-naming
- name: import-shadowing
- name: redundant-import-alias
unparam:
check-exported: true
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The configuration structure has been changed incorrectly. In golangci-lint v1.x, linter settings should be under a top-level 'linters-settings' section, not nested under 'linters.settings'. The current structure 'linters.settings' is not valid for golangci-lint v1.x and will likely cause configuration parsing errors.

Copilot uses AI. Check for mistakes.
severity:
default-severity: error
case-sensitive: false
default: error
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The 'severity.default' field uses 'error' instead of 'default-severity: error'. In golangci-lint v1.x configuration, the correct field name is 'default-severity', not 'default'. This should be corrected to match the v1.x configuration format.

Suggested change
default: error
default-severity: error

Copilot uses AI. Check for mistakes.
echo "golangci-lint $(GOLANGCI_LINT_VERSION) is already installed"; \
else \
echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION)"; \
$(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The module path 'github.com/golangci/golangci-lint/v2/cmd/golangci-lint' is incorrect as golangci-lint does not have a v2 major version. The correct module path for golangci-lint v1.x is 'github.com/golangci/golangci-lint/cmd/golangci-lint'. Please update this to use the correct module path.

Suggested change
$(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \
$(call go-install-tool-branch,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)); \

Copilot uses AI. Check for mistakes.
@@ -1,127 +1,102 @@
# Documentation reference https://github.com/golangci/golangci-lint/blob/v1.55.2/.golangci.reference.yml
version: "2"
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The 'version: "2"' configuration format does not exist for golangci-lint. The golangci-lint configuration file does not use a version field in this manner. This line should be removed as it's not a valid configuration option for golangci-lint v1.x.

Suggested change
version: "2"

Copilot uses AI. Check for mistakes.
Comment on lines 7 to 20
enable:
- asasalint
- asciicheck
- bidichk
# - bodyclose
- dogsled
# - dupword
# - durationcheck
# - errcheck
- errchkjson
- exportloopref
- gci
# - ginkgolinter
# - goconst
- gofmt
# - goheader
- goprintffuncname
# - gosec
# - gosimple
# - govet
# - ineffassign
- loggercheck
# - misspell
- nakedret
# - nilerr
# - noctx
- nolintlint
- nosprintfhostport
- revive
# - staticcheck
# - stylecheck
# - unconvert
- unparam
# - unused
- usestdlibvars
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

Critical linters have been removed from the enabled list that were previously active. Important linters like 'errcheck' (checks for unchecked errors), 'gosimple' (simplification suggestions), 'govet' (Go's built-in vet tool), 'ineffassign' (detects ineffectual assignments), 'staticcheck' (comprehensive static analysis), 'unused' (finds unused code), 'gosec' (security checks), 'misspell' (spelling), 'gofmt' (formatting), and 'gci' (import ordering) are no longer enabled. These linters provide essential code quality and security checks. Consider re-enabling these linters unless there is a specific reason to disable them.

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +79
exclusions:
generated: lax
rules:
- linters:
- revive
text: '^struct-tag: unknown option ''inline'' in JSON tag$'
- linters:
- staticcheck
text: 'ST1000:|ST1020:|ST1021:|ST1022:'
paths:
- third_party$
- builtin$
- examples$
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The 'linters.exclusions' section is not a valid configuration structure in golangci-lint v1.x. Exclusion rules should be under 'issues.exclude-rules' or 'issues.exclude-dirs' at the top level, not nested under 'linters.exclusions'. This configuration will not work as intended.

Copilot uses AI. Check for mistakes.
Comment on lines +85 to +102
formatters:
enable:
- gci
- gofmt
settings:
gci:
sections:
- standard
- default
- prefix(github.com/openshift/oadp-operator)
gofmt:
simplify: true
exclusions:
generated: lax
paths:
- third_party$
- builtin$
- examples$
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The 'formatters' section is not a standard golangci-lint configuration section in v1.x. Formatters like 'gci' and 'gofmt' should be enabled as linters in the 'linters.enable' list, not in a separate 'formatters' section. This configuration structure will not be recognized by golangci-lint v1.x.

Copilot uses AI. Check for mistakes.
Comment on lines +24 to +48
errcheck:
check-type-assertions: true
check-blank: true
goconst:
min-len: 3
min-occurrences: 5
goheader:
template: |-
Copyright 2021.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
govet:
enable-all: true
misspell:
locale: US
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

Settings for 'errcheck', 'goconst', 'goheader', 'govet', and 'misspell' linters are configured, but these linters are not enabled in the 'linters.enable' list. These settings will have no effect unless the corresponding linters are also enabled. Either remove these unused settings or add the linters to the enabled list.

Copilot uses AI. Check for mistakes.
@kaovilai kaovilai linked an issue Jan 19, 2026 that may be closed by this pull request
@kaovilai
Copy link
Member Author

/retest

@openshift-ci
Copy link

openshift-ci bot commented Jan 20, 2026

@kaovilai: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/4.20-e2e-test-aws 5032d63 link true /test 4.20-e2e-test-aws
ci/prow/4.20-e2e-test-hcp-aws 5032d63 link true /test 4.20-e2e-test-hcp-aws
ci/prow/4.19-e2e-test-aws 5032d63 link true /test 4.19-e2e-test-aws
ci/prow/4.19-e2e-test-hcp-aws 5032d63 link true /test 4.19-e2e-test-hcp-aws
ci/prow/unit-test 5032d63 link true /test unit-test
ci/prow/4.20-e2e-test-kubevirt-aws 5032d63 link true /test 4.20-e2e-test-kubevirt-aws
ci/prow/4.19-e2e-test-kubevirt-aws 5032d63 link true /test 4.19-e2e-test-kubevirt-aws

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.

@kaovilai
Copy link
Member Author

base branch test fix #2071 (review)

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

oadp-1.5: cp https://github.com/openshift/oadp-operator/pull/1721

1 participant