Skip to content

🌱 Bump golangci-lint v2 #12088

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

sivchari
Copy link
Member

What this PR does / why we need it:

golangci-lint v2 is already released and it's so helpful to maintain codebase until now and from now on, so let's migrate it from v1 to v2.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #12087

/kind cleanup
/kind bug
/area ci

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. kind/bug Categorizes issue or PR as related to a bug. area/ci Issues or PRs related to ci cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 12, 2025
@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 12, 2025
@sivchari
Copy link
Member Author

/hold
/assign

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 12, 2025
@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch 2 times, most recently from d79565d to de82fdf Compare April 12, 2025 08:13
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 12, 2025
@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch 6 times, most recently from 2b74f5d to 988c2a5 Compare April 13, 2025 07:38
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Apr 13, 2025
@sivchari sivchari changed the title 🌱 [WIP] Bump golangci-lint v2 🌱 Bump golangci-lint v2 Apr 13, 2025
.golangci.yml Outdated
text: 'SA1019: feature.ClusterResourceSet is deprecated: ClusterResourceSet feature is now GA and the corresponding feature flag will be removed in 1.12 release.'
- linters:
- staticcheck
text: 'SA1019: .* is deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped.'
Copy link
Member Author

Choose a reason for hiding this comment

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

I only added this exclusive rule. The diagnostic should be reported before this PR, but prow couldn't collect it somehow.
So it's not problem to add new one.

Copy link
Member

Choose a reason for hiding this comment

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

I think this was covered before via:

    text: "SA1019: .*\\.Deprecated\\.V1Beta1.* is deprecated"

@sivchari
Copy link
Member Author

/assign @chrischdi

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from chrischdi. For more information see the Code Review Process.

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

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

Makefile Outdated
@@ -160,9 +160,9 @@ GINKGO := $(abspath $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER))
GINKGO_PKG := github.com/onsi/ginkgo/v2/ginkgo

GOLANGCI_LINT_BIN := golangci-lint
GOLANGCI_LINT_VER := $(shell cat .github/workflows/pr-golangci-lint.yaml | grep [[:space:]]version: | sed 's/.*version: //')
GOLANGCI_LINT_VER := v2.0.2
Copy link
Member

Choose a reason for hiding this comment

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

Let's revert this if possible and also use the native action (when not running kubeapilinter), because its visualization is a bit better.

@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch from d183f07 to 8025ba2 Compare April 14, 2025 13:26
@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch from 7e874af to 15b826a Compare April 14, 2025 13:43
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 15, 2025
@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch from 15b826a to 25673d5 Compare April 16, 2025 03:42
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 16, 2025
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

Thank you for working on this. Looks promising, some last nits.

@chrischdi chrischdi added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 16, 2025
.golangci.yml Outdated
Comment on lines 264 to 266
- linters:
- staticcheck
text: 'SA1019: .* is deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped.'
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- linters:
- staticcheck
text: 'SA1019: .* is deprecated: This field is deprecated and is going to be removed when support for v1beta1 will be dropped.'
# v1Beta1 deprecated fields
- linters:
- staticcheck
text: 'SA1019: .*\.Deprecated\.V1Beta1.* is deprecated'

Let's keep the old regex here :-)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank :) Fixed!

Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

last one :-)

Signed-off-by: sivchari <[email protected]>
@sivchari sivchari force-pushed the migrate-golangci-lint-v2 branch from 2702f96 to 8530749 Compare April 16, 2025 12:33
Copy link
Member

@chrischdi chrischdi left a comment

Choose a reason for hiding this comment

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

/lgtm

🎉

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 16, 2025
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: b95b8a4fa5432971a53d4acd8666d30638a42903

@chrischdi
Copy link
Member

/assign @fabriziopandini

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ci Issues or PRs related to ci cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/bug Categorizes issue or PR as related to a bug. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump to golangci-lint v2
4 participants