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

🌱 Update golangci-lint and Go version for golangci-lint workflow #6737

Merged
merged 1 commit into from Aug 19, 2022

Conversation

oscr
Copy link
Contributor

@oscr oscr commented Jun 26, 2022

What this PR does / why we need it:

Updates the GitHub workflow to use Go 1.18 and bumps golangci-lint 1.44.0 -> 1.48.0. Also fixes findings by the upgraded linter.

Reference sources:
https://github.com/golangci/golangci-lint/releases
golangci/golangci-lint#2438

Part of #5968
Fixes #6350

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 26, 2022
@k8s-ci-robot
Copy link
Contributor

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

@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Jun 26, 2022
@chrischdi
Copy link
Member

We need a version which includes #6350 (comment)

/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 26, 2022
@sbueringer
Copy link
Member

sbueringer commented Jun 27, 2022

@oscr
Please add the following to the PR description

Part of #5968
Fixes #6350

(2nd one is true after the next golangci-lint release)

@oscr oscr force-pushed the github-workflow-go-version branch from 33b29e1 to 55651d9 Compare June 27, 2022 07:27
@oscr
Copy link
Contributor Author

oscr commented Jun 27, 2022

@oscr Please add the following to the PR description

Part of #5968 Fixes #6350

(2nd one is true after the next golangci-lint release)

Sure! I will bump the golangci-lint version as soon as it's available.

@sbueringer
Copy link
Member

Perfect. Thank you!

lgtm so far

/ok-to-test

@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 Jun 27, 2022
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 5, 2022
@sbueringer
Copy link
Member

@oscr You can rebase once #6943 is merged

@killianmuldoon
Copy link
Contributor

@oscr It would be good to dedupe this with #6943 - would you mind picking up tracking the linter update here as we move toward finally being able to update? 😆

@killianmuldoon
Copy link
Contributor

killianmuldoon commented Jul 25, 2022

Summary of learnings from #6943:

v1.47.1 does not work due to performance issues in the revive linter. v1.47.2 disables the problematic linters allowing that version of golangci-lint to be used on CAPI at the cost of some linter coverage.

At this point we could:

  • Delay update for now and see if the bug can be fixed in the next couple of weeks
  • Update but keep the exclusions in the config so we can roll them back once a fix is out
    @fabriziopandini WDYT?

@chrischdi
Copy link
Member

Relevant for discussing if to delay or not: golangci/golangci-lint#2997 (comment)

List of disabled linters:

@oscr oscr force-pushed the github-workflow-go-version branch from 55651d9 to f9a3a9e Compare July 25, 2022 12:45
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jul 25, 2022
@oscr
Copy link
Contributor Author

oscr commented Jul 25, 2022

I just want to highlight a change. When I cherry picked the changes from #6943 I got some nolintlint findings:

util/defaulting/defaulting.go:28:38: directive `//nolint:revive` is unused for linter "revive" (nolintlint)
type DefaultingValidator interface { //nolint:revive
                                     ^
cmd/clusterctl/client/alpha/rollout_pauser.go:39:92: directive `//nolint:revive // MachineDeployment is intentionally capitalized.` is unused for linter "revive" (nolintlint)
			return errors.Errorf("MachineDeploymet is already paused: %v/%v\n", ref.Kind, ref.Name) //nolint:revive // MachineDeployment is intentionally capitalized.
			                                                                                        ^
cmd/clusterctl/client/alpha/rollout_resumer.go:39:99: directive `//nolint:revive // MachineDeployment is intentionally capitalized.` is unused for linter "revive" (nolintlint)
			return errors.Errorf("MachineDeployment is not currently paused: %v/%v\n", ref.Kind, ref.Name) //nolint:revive // MachineDeployment is intentionally capitalized.
			                                                                                               ^
controlplane/kubeadm/internal/etcd/fake/client.go:26:30: directive `//nolint:revive` is unused for linter "revive" (nolintlint)
type FakeEtcdClient struct { //nolint:revive
                             ^
cmd/clusterctl/internal/test/fake_proxy.go:50:35: directive `//nolint:revive` is unused for linter "revive" (nolintlint)
	FakeScheme = runtime.NewScheme() //nolint:revive

So I temporary allowed unused in nolintlint until revive is fully enabled again.

nolintlint:
    allow-unused: true # TODO(oscr) Set to false when revive linter is fully enabled again.` 

I this ok?

@killianmuldoon
Copy link
Contributor

So I temporary allowed unused in nolintlint until revive is fully enabled again.
I this ok?

Yeah - that's perfectly fine I think.

@oscr
Copy link
Contributor Author

oscr commented Jul 25, 2022

/test pull-cluster-api-e2e-informing-main

@killianmuldoon
Copy link
Contributor

Part of #5968

@killianmuldoon killianmuldoon mentioned this pull request Jul 25, 2022
33 tasks
Copy link
Contributor

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

Could you also bump the go versions in .golangci.yml? I think it's in there twice.

@@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

Copy link
Contributor

Choose a reason for hiding this comment

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

🤯

@oscr oscr force-pushed the github-workflow-go-version branch from 043fa69 to a1693ec Compare August 18, 2022 18:53
Copy link
Contributor

@killianmuldoon killianmuldoon 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 Aug 18, 2022
@oscr oscr force-pushed the github-workflow-go-version branch from a1693ec to 1f42343 Compare August 19, 2022 11:52
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 19, 2022
… for lint workflow

Also fix new lint findings
@oscr oscr force-pushed the github-workflow-go-version branch from 1f42343 to 1075dd2 Compare August 19, 2022 11:57
@oscr oscr requested review from sbueringer and killianmuldoon and removed request for stmcginnis, JoelSpeed, sbueringer and killianmuldoon August 19, 2022 11:59
@oscr
Copy link
Contributor Author

oscr commented Aug 19, 2022

Sorry for the spam.

@sbueringer
Copy link
Member

sbueringer commented Aug 19, 2022

No worries :)

/lgtm

cc @killianmuldoon for a final look

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

@killianmuldoon killianmuldoon left a comment

Choose a reason for hiding this comment

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

/lgtm

Thanks again for following this one through @oscr!

@sbueringer
Copy link
Member

Yup thank you very much!

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sbueringer

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 Aug 19, 2022
@k8s-ci-robot k8s-ci-robot merged commit e2bb351 into kubernetes-sigs:main Aug 19, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.3 milestone Aug 19, 2022
@oscr oscr deleted the github-workflow-go-version branch August 19, 2022 12:49
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

gci linter no longer autofixing import orders
6 participants