Skip to content

Conversation

@apricote
Copy link
Member

What this PR does / why we need it:

With versions lower than 1.45.0, golangci-lint returns a lot of invalid errors when running in Go 1.18+. Because of this, all PR pipeline jobs pull-cluster-api-provider-openstack-test fail.

This commit upgrades golangci-lint to the latest released version and fixes all linting errors that came up.

Special notes for your reviewer:

  1. Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

/hold

@apricote
Copy link
Member Author

/cherry-pick release-0.5

@apricote apricote mentioned this pull request Mar 24, 2022
3 tasks
@tobiasgiese
Copy link
Member

tobiasgiese commented Mar 24, 2022

/lgtm
/approve

thanks @apricote 👌🏻

Copy link
Contributor

@seanschneeweiss seanschneeweiss left a comment

Choose a reason for hiding this comment

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

/lgtm
Thank you very much for fixing this.

// Event constructs an event from the given information and puts it in the queue for sending.
func Event(object runtime.Object, reason, message string) {
defaultRecorder.Event(object, corev1.EventTypeNormal, strings.Title(reason), message)
defaultRecorder.Event(object, corev1.EventTypeNormal, cases.Title(language.Und).String(reason), message)
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity, what is the language.Und doing?

Copy link
Contributor

Choose a reason for hiding this comment

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

same question here..

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is for Undefined language, it's not really explained in the [docs]. Using this language tag returned the expected result, as you can see in this Go Playground example: https://go.dev/play/p/fNew-KrewPY

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Maybe change it to language.English then?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think that makes sense, considering the reasons should be in english so all consumers of them can understand them.

@k8s-triage-robot
Copy link

Unknown CLA label state. Rechecking for CLA labels.

Send feedback to sig-contributor-experience at kubernetes/community.

/check-cla
/easycla

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 24, 2022
@tobiasgiese
Copy link
Member

/check-cla
/retest
/approve
/lgtm

I think prow had some issues today

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: apricote, tobiasgiese

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 24, 2022
@tobiasgiese
Copy link
Member

/cherry-pick release-0.5

@k8s-infra-cherrypick-robot

@tobiasgiese: once the present PR merges, I will cherry-pick it on top of release-0.5 in a new PR and assign it to you.

In response to this:

/cherry-pick release-0.5

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.

@jichenjc
Copy link
Contributor

/test pull-cluster-api-provider-openstack-test

@jichenjc
Copy link
Contributor

@apricote guess you forgot to run go mod tidy to update go.sum?


// OpenStackClusterSpec defines the desired state of OpenStackCluster.
type OpenStackClusterSpec struct {

Copy link
Contributor

Choose a reason for hiding this comment

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

unrelated change..

Copy link
Member Author

Choose a reason for hiding this comment

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

These are changes that golangci-lint requested after I upgrade it. In this case the structs were not formatted with gofumpt

// Event constructs an event from the given information and puts it in the queue for sending.
func Event(object runtime.Object, reason, message string) {
defaultRecorder.Event(object, corev1.EventTypeNormal, strings.Title(reason), message)
defaultRecorder.Event(object, corev1.EventTypeNormal, cases.Title(language.Und).String(reason), message)
Copy link
Contributor

Choose a reason for hiding this comment

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

same question here..

@lentzi90 lentzi90 mentioned this pull request Mar 25, 2022
3 tasks
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Mar 25, 2022
@netlify
Copy link

netlify bot commented Mar 25, 2022

Deploy Preview for kubernetes-sigs-cluster-api-openstack ready!

Name Link
🔨 Latest commit e004f2b
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-cluster-api-openstack/deploys/623d9120b2024a00083f52f8
😎 Deploy Preview https://deploy-preview-1184--kubernetes-sigs-cluster-api-openstack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Mar 25, 2022
@apricote
Copy link
Member Author

@apricote guess you forgot to run go mod tidy to update go.sum?

Looks like I forgot to run it a second time after fixing the linting issues. New commit is up

With versions lower than 1.45.0, golangci-lint returns a lot of invalid
errors when running in Go 1.18+.

This commit upgrades golangci-lint to the latest released version and fixes
all linting errors that came up.
@apricote
Copy link
Member Author

/retest

1 similar comment
@chrischdi
Copy link
Member

/retest

Copy link
Member

@chrischdi chrischdi 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 Mar 25, 2022
@mdbooth
Copy link
Contributor

mdbooth commented Mar 25, 2022

/lgtm

@pierreprinetti
Copy link
Contributor

pass! hurray!

@k8s-ci-robot k8s-ci-robot merged commit b28f11f into kubernetes-sigs:main Mar 25, 2022
@apricote apricote deleted the fix-ci-go-18 branch March 25, 2022 14:34
@apricote
Copy link
Member Author

/cherry-pick release-0.5

third time's a charm

@apricote
Copy link
Member Author

/cherry-pick release-0.5

Third time also didn't work and I forgot about this afterwards, we are currently hitting this issue on #1204.

@k8s-infra-cherrypick-robot

@apricote: #1184 failed to apply on top of branch "release-0.5":

Applying: upgrade golangci-lint for go 1.18 support
Using index info to reconstruct a base tree...
M	api/v1alpha3/openstackcluster_types.go
M	api/v1alpha4/openstackmachine_types.go
A	api/v1beta1/openstackmachine_types.go
M	go.mod
M	hack/tools/go.mod
M	hack/tools/go.sum
Falling back to patching base and 3-way merge...
Auto-merging hack/tools/go.sum
CONFLICT (content): Merge conflict in hack/tools/go.sum
Auto-merging hack/tools/go.mod
CONFLICT (content): Merge conflict in hack/tools/go.mod
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
CONFLICT (modify/delete): api/v1beta1/openstackmachine_types.go deleted in HEAD and modified in upgrade golangci-lint for go 1.18 support. Version upgrade golangci-lint for go 1.18 support of api/v1beta1/openstackmachine_types.go left in tree.
Auto-merging api/v1alpha4/openstackmachine_types.go
Auto-merging api/v1alpha3/openstackcluster_types.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 upgrade golangci-lint for go 1.18 support
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-0.5

Third time also didn't work and I forgot about this afterwards, we are currently hitting this issue on #1204.

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.

johananl added a commit to johananl/cluster-api-provider-vsphere that referenced this pull request Sep 1, 2022
Using strings.Title is deprecated in Go 1.18.

This change is similar to
kubernetes-sigs/cluster-api-provider-openstack#1184.

Signed-off-by: Johanan Liebermann <[email protected]>
johananl added a commit to johananl/cluster-api-provider-vsphere that referenced this pull request Sep 1, 2022
Using strings.Title is deprecated in Go 1.18.

This change is similar to
kubernetes-sigs/cluster-api-provider-openstack#1184.

Signed-off-by: Johanan Liebermann <[email protected]>
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.