Skip to content

chore: bump golangci lint to v2 #8203

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 1 commit into
base: master
Choose a base branch
from

Conversation

jklaw90
Copy link

@jklaw90 jklaw90 commented Jun 6, 2025

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

version 2 of golangci-lint. its been out for a little while now.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?

bump golangci-lint to v2

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:


@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jun 6, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jklaw90
Once this PR has been reviewed and has the lgtm label, please assign towca for approval. 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

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 6, 2025
Comment on lines 1 to 3
version: "2"
linters:
default: none
Copy link
Member

@omerap12 omerap12 Jun 7, 2025

Choose a reason for hiding this comment

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

Can you explain why we need this?
I see that v8.0.0 works with golangci-lint version >= v2.1.0, ref: https://github.com/golangci/golangci-lint-action?tab=readme-ov-file#compatibility . should this version needs to be changed?

Copy link
Author

Choose a reason for hiding this comment

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

i assumed it was off by default in v1. but it seems staticcheck just is flagging a lot more stuff in v2. updated to address issues. I can also leave the text as is and add no lints if you'd like.

Copy link
Author

Choose a reason for hiding this comment

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

can proceed with these changes or ignore the all these inline?
also i figured after seeing all the duplicate imports we should order it with gci to make things more visible

Copy link
Member

Choose a reason for hiding this comment

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

IMHO I think it's good to have those lints.
@adrianmoisey WDYT?

@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 Jun 10, 2025
@jklaw90 jklaw90 force-pushed the julian/golangci-lint-v2 branch from e91fd44 to 9995f2d Compare June 10, 2025 04:30
Comment on lines -197 to +194
if resizePendingCondition.Reason == apiv1.PodReasonDeferred {
switch resizePendingCondition.Reason {
case apiv1.PodReasonDeferred:
Copy link
Member

@omerap12 omerap12 Jun 10, 2025

Choose a reason for hiding this comment

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

Are those changes required because of the new linter?

Copy link
Author

@jklaw90 jklaw90 Jun 10, 2025

Choose a reason for hiding this comment

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

Yeah, staticcheck flagged almost all of them.

Copy link
Member

Choose a reason for hiding this comment

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

That's cool.

Copy link
Member

@omerap12 omerap12 left a comment

Choose a reason for hiding this comment

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

Personally, I like it. I'd love for the other approvers to take a look as well.
We can't merge it yet until the failed unit test is fixed, so I'm adding a hold to prevent accidental merging.
/lgtm
/hold

@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 Jun 10, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2025
@jklaw90 jklaw90 force-pushed the julian/golangci-lint-v2 branch from 9995f2d to 57a4cec Compare June 10, 2025 15:47
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 10, 2025
@jklaw90 jklaw90 force-pushed the julian/golangci-lint-v2 branch from 57a4cec to c84a7b7 Compare June 10, 2025 15:49
@jklaw90
Copy link
Author

jklaw90 commented Jun 10, 2025

seems to be failing cluster autoscaler tests from main. I'll wait till they fix it and rebase

@adrianmoisey
Copy link
Member

There's a lot here, it all seems OK to me.
Pinging @voelzmo and @raywainman for more eyes

@jackfrancis
Copy link
Contributor

@jklaw90 you can rebase off of current master, CA UT is fixed

updated to enable by default

imports clean up

fixing test cases
@jklaw90 jklaw90 force-pushed the julian/golangci-lint-v2 branch from c84a7b7 to 504a985 Compare June 10, 2025 19:42
@jklaw90
Copy link
Author

jklaw90 commented Jun 10, 2025

@jackfrancis done, thank you

@omerap12
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/vertical-pod-autoscaler 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/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/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.

5 participants