Skip to content
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

🌱 Upgrade to golangci-lint v1.44 and fix findings #6014

Merged

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Jan 27, 2022

Signed-off-by: Stefan Büringer [email protected]

What this PR does / why we need it:

This PR upgrades golangci-lint to v1.44 and adds the new containedctx linter (for context, see: # https://go.dev/blog/context-and-structs)

I also looked at the other new linters in the release notes, but I don't think we should add one of them:

  • decorder: Sounds too opinionated
  • errchkjson: If I got it right, it would allow ignoring errors on e.g. json.Marshal if it's safe. Not sure if we need/want that.
  • maintidx: Checks for maintainability (similar to gocyclo). Based on their doc it's an "an experimental value". It would currently only complains about our ClusterctlUpgradeSpec test. I think let's just continue using gocyclo for now.
  • grouper: Can enforce grouping. I think we have a few other linters which e.g. force correct grouping of imports.

xref: golangci-lint release notes: https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#v1440

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 #

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 27, 2022
@sbueringer sbueringer force-pushed the pr-upgrade-golangci-lint-to-1.44 branch from f794e60 to 09fa177 Compare January 27, 2022 20:01
@sbueringer
Copy link
Member Author

@stmcginnis
Copy link
Contributor

/lgtm

Updates all seem reasonable.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 27, 2022
.golangci.yml Show resolved Hide resolved
@enxebre
Copy link
Member

enxebre commented Jan 28, 2022

for ref https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#v1440
/lgtm

@sbueringer
Copy link
Member Author

for ref https://github.com/golangci/golangci-lint/blob/master/CHANGELOG.md#v1440 /lgtm

Thx, I also added it to the PR description

@sbueringer sbueringer force-pushed the pr-upgrade-golangci-lint-to-1.44 branch from 09fa177 to f5c4b43 Compare January 28, 2022 12:02
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2022
@sbueringer
Copy link
Member Author

sbueringer commented Jan 28, 2022

Thx for the reviews!
I added a comment above the testFunc hacks to link the issue I opened in thelper, so we'll hopefully can get rid of it after the issue is fixed there.

I also took a look at all new linters and added the containectx linter. I added some notes in the PR description about the others. Originally I wanted to open a separate PR, but as it's only enabling that one linter (which sounds reasonable) and no code changes, I think it's okay to include it in this PR.

@stmcginnis
Copy link
Contributor

Changes still look good to me. Thanks for adding linter analysis in the PR description, that could be a helpful reference in the future.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 28, 2022
@sbueringer sbueringer force-pushed the pr-upgrade-golangci-lint-to-1.44 branch from 2f9ffb6 to dece5b1 Compare January 31, 2022 18:48
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 31, 2022
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jan 31, 2022
@vincepri
Copy link
Member

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

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 Jan 31, 2022
@k8s-ci-robot k8s-ci-robot merged commit 7f3c5f0 into kubernetes-sigs:main Jan 31, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.2 milestone Jan 31, 2022
@sbueringer sbueringer deleted the pr-upgrade-golangci-lint-to-1.44 branch February 1, 2022 08:40
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. 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.

6 participants