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

golangci-lint update and support for Go 1.21 #119860

Merged
merged 1 commit into from
Aug 16, 2023

Conversation

pohly
Copy link
Contributor

@pohly pohly commented Aug 9, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

v1.54.0 is the first release with official support for Go 1.21. go-ruleguard
must be >= 0.3.20 because of
quasilyte/go-ruleguard#449 with Go
1.21. golangci-lint itself doesn't depend on a recent enough release yet, so
this was done manually.

One downside of updating golangci-lint to v1.54.0 without also updating
logcheck is that golangci-lint now complains about logcheck using the old
plugin API:

    ERROR: level=warning msg="plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: https://golangci-lint.run/contributing/new-linters/#create-a-plugin"

Related-to: kubernetes/release#3076

Special notes for your reviewer:

There is an issue with go-critic and ruleguard which needs a workaround in verify-golangci-lint.sh: the Go toolchain used for compiling the linter must not be inside a Go module.

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 9, 2023
@k8s-ci-robot
Copy link
Contributor

Please note that we're already in Test Freeze for the release-1.28 branch. This means every merged PR will be automatically fast-forwarded via the periodic ci-fast-forward job to the release branch of the upcoming v1.28.0 release.

Fast forwards are scheduled to happen every 6 hours, whereas the most recent run was: Wed Aug 9 10:32:39 UTC 2023.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 9, 2023
@k8s-ci-robot k8s-ci-robot added do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Aug 9, 2023
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If a SIG or subproject determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

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/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-priority Indicates a PR lacks a `priority/foo` label and requires one. label Aug 9, 2023
@pohly pohly changed the title golangci-lint update and support for Go 1.21 WIP: golangci-lint update and support for Go 1.21 Aug 9, 2023
@k8s-ci-robot k8s-ci-robot added do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Aug 9, 2023
@pohly
Copy link
Contributor Author

pohly commented Aug 9, 2023

This is WIP because:

@liggitt
Copy link
Member

liggitt commented Aug 9, 2023

there may be a fix for the go1.21 / go-critic issue to try, see #119037 (comment)

@pohly
Copy link
Contributor Author

pohly commented Aug 10, 2023

I've tried that fix by bumping the github.com/quasilyte/go-ruleguard dependency and that seems to work.

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/contains-merge-commits Indicates a PR which contains merge commits. label Aug 10, 2023
@liggitt
Copy link
Member

liggitt commented Aug 10, 2023

In order to bump release branches to go1.21, we'll need to pick any required changes to support go1.21 back. Can this PR be split into the minimal set to run on go1.21, and a follow-up to switch to the new plugin interface to keep the size of the backports as small as possible?

@pohly pohly changed the title WIP: golangci-lint update and support for Go 1.21 golangci-lint update and support for Go 1.21 Aug 10, 2023
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 10, 2023
@pohly
Copy link
Contributor Author

pohly commented Aug 16, 2023

https://github.com/golangci/golangci-lint/pull/4002/files added an env variable for suppressing the warning. This is included in this PR now.

That release is the first one with official support for Go 1.21. go-ruleguard
must be >= 0.3.20 because of
quasilyte/go-ruleguard#449 with Go
1.21. golangci-lint itself doesn't depend on a recent enough release yet, so
this was done manually.
@pohly pohly changed the title golangci-lint update and support for Go 1.21 WIP: golangci-lint update and support for Go 1.21 Aug 16, 2023
@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 16, 2023
@pohly pohly changed the title WIP: golangci-lint update and support for Go 1.21 golangci-lint update and support for Go 1.21 Aug 16, 2023
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Aug 16, 2023
@pohly
Copy link
Contributor Author

pohly commented Aug 16, 2023

/hold

To prevent merging without additional approval from someone else.

@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 Aug 16, 2023
@pohly
Copy link
Contributor Author

pohly commented Aug 16, 2023

/retest

@liggitt
Copy link
Member

liggitt commented Aug 16, 2023

/lgtm
/approve
/hold cancel

go ahead and open picks to release-1.25+ branches once this merges so those will be prepped for go1.21 whenever it makes it back to those branches

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 16, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: fe6e939c574a952c423a80401bc8f0fc628036a1

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, pohly

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

@liggitt
Copy link
Member

liggitt commented Aug 16, 2023

/sig testing

@pohly
Copy link
Contributor Author

pohly commented Aug 17, 2023

Cherry-picks created.

k8s-ci-robot added a commit that referenced this pull request Sep 6, 2023
…0-origin-release-1.28

Automated cherry pick of #119860: update to golangci-lint v1.54.1 + go-ruleguard v0.4.0
k8s-ci-robot added a commit that referenced this pull request Sep 6, 2023
…0-origin-release-1.27

Automated cherry pick of #119860: update to golangci-lint v1.54.1 + go-ruleguard v0.4.0
k8s-ci-robot added a commit that referenced this pull request Sep 6, 2023
…0-origin-release-1.26

Automated cherry pick of #119860: update to golangci-lint v1.54.1 + go-ruleguard v0.4.0
k8s-ci-robot added a commit that referenced this pull request Sep 6, 2023
…0-origin-release-1.25

Automated cherry pick of #119860: update to golangci-lint v1.54.1 + go-ruleguard v0.4.0
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 Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/testing Categorizes an issue or PR as relevant to SIG Testing. 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.

3 participants