Skip to content

🌱 [release-2.6] Bump golangci-lint to v1.62.2 and fix all lint errors #5377

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

Merged
merged 1 commit into from
Mar 7, 2025

Conversation

r4f4
Copy link
Contributor

@r4f4 r4f4 commented Mar 7, 2025

This fixes the issue of shadowing the builtins min/max shadowed by local variables declaration.

This has been fixed in newer branches via #5255

What type of PR is this?

/kind cleanup

What this PR does / why we need it: Fix a linting issue in the 2.6 branch

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 #

Special notes for your reviewer:

Issue found while testing #5226

Checklist:

  • squashed commits
  • includes documentation
  • includes emoji in title
  • adds unit tests
  • adds or updates e2e tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. release-note-none Denotes a PR that doesn't merit a release note. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Mar 7, 2025
@k8s-ci-robot k8s-ci-robot requested review from Ankitasw and enxebre March 7, 2025 15:43
@k8s-ci-robot k8s-ci-robot added needs-priority needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 7, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @r4f4. Thanks for your PR.

I'm waiting for a kubernetes-sigs 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. Regular contributors should join the org to skip this step.

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.

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.

@nrb
Copy link
Contributor

nrb commented Mar 7, 2025

/ok-to-test
/approve

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 7, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nrb

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 7, 2025
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 7, 2025

Should we bump the linter version? In #5255 @AndiDog mentions panics in the 1.56 version

For me, the local execution with the old version gave some panics and different results.

 level=error msg="[linters_context/goanalysis] nilness: panic during analysis: interface conversion: interface {} is nil, not *buildir.IR, goroutine 26765 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:26 +0x5e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:104 +0x5a\npanic({0x171b1c0?, 0xc014799470?})\n\t/usr/local/go/src/runtime/panic.go:785 +0x132\nhonnef.co/go/tools/analysis/facts/nilness.run(0xc003af36c0)\n\t/home/prow/go/pkg/mod/honnef.co/go/[email protected]/analysis/facts/nilness/nilness.go:65 +0x277\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0061352d0)\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:190 +0x9cd\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:112 +0x17\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0010dab90, {0x187b3d8, 0x7}, 0xc006a18748)\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x44\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc01460b9e0?)\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:111 +0x6e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0061352d0)\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa5\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 7537\n\t/home/prow/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1e9\n" 

@damdo
Copy link
Member

damdo commented Mar 7, 2025

Yeah let's

@r4f4
Copy link
Contributor Author

r4f4 commented Mar 7, 2025

Ok. So let's try to cherry-pick #5255.

@r4f4 r4f4 force-pushed the fix-linter-2.6 branch from 236a1a2 to f577be9 Compare March 7, 2025 18:02
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 7, 2025
@r4f4 r4f4 changed the title 🌱 fix linting predeclared issue 🌱 [release-2.6] Bump golangci-lint to v1.62.2 and fix all lint errors Mar 7, 2025
@r4f4
Copy link
Contributor Author

r4f4 commented Mar 7, 2025

Update: this PR has now become a manual cherry-pick of #5255

@damdo
Copy link
Member

damdo commented Mar 7, 2025

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 7, 2025
@k8s-ci-robot k8s-ci-robot merged commit d393518 into kubernetes-sigs:release-2.6 Mar 7, 2025
17 checks passed
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. 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. needs-priority ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants