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 go to 1.18 #1895

Closed
wants to merge 1 commit into from

Conversation

Vaxuite
Copy link

@Vaxuite Vaxuite commented May 9, 2022

Updates the go version to 1.18 and fixes all of the linter errors that result from doing so.

@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 May 9, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @Vaxuite. 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
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Vaxuite
To complete the pull request process, please assign mengqiy after the PR has been reviewed.
You can assign the PR to them by writing /assign @mengqiy in a comment when ready.

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 May 9, 2022
@alvaroaleman
Copy link
Member

/hold
We already use go 1.18, I am not sure I see the need to update the go.mod file. I am also not sure I understand why that would change anything about what the linter complains about or not.

@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 May 9, 2022
@Vaxuite
Copy link
Author

Vaxuite commented May 10, 2022

@alvaroaleman apparently we needed to bump this to update kubebuilder? kubernetes-sigs/kubebuilder#2559

@@ -185,7 +185,7 @@ func (c *multiNamespaceCache) WaitForCacheSync(ctx context.Context) bool {
func (c *multiNamespaceCache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error {
isNamespaced, err := objectutil.IsAPINamespaced(obj, c.Scheme, c.RESTMapper)
if err != nil {
return nil //nolint:nilerr
return nil //nolint:ignore
Copy link
Member

Choose a reason for hiding this comment

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

Why are we changing the linters?

Copy link
Member

Choose a reason for hiding this comment

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

@Vaxuite @alvaroaleman, it shows that what is not right here is we change the liners.
However, to make C+R begin to use go 1.18, why should we not bump the modules?
I could not follow that.

Copy link
Member

@camilamacedo86 camilamacedo86 May 10, 2022

Choose a reason for hiding this comment

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

I'm with @alvaroaleman here; I'm not sure if there's an immediate reason to update the go.mod's go version unless we do that on purpose to support go 1.18 features

usually, we bump the k8s version and go modules on deps before we upgrade Kubebuilder
Why?

  • We want to ensure the same go version across the projects in the same ecosystem. Otherwise, it is hard for contributors to switch the projects.
  • We faced problems in the past based on incompatibilities, i.e. with go 1.17:

For example, with some recent changes, we can't use k8s 1.23 with older versions of Go (For ex: operator-framework/operator-sdk#5558 (comment)) - this is a vice versa case.

Then, I do not understand how controller-runtime is using go 1.18 when its go mods are not bumped with 1.18?

Copy link
Author

Choose a reason for hiding this comment

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

So when you specify the go version in the module file its a minimum version the module must run with. So with this module on go 1.17, if you run it with go 1.18 that will work fine and this does not really need changing.

Copy link
Author

Choose a reason for hiding this comment

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

What made you think that this module needed to be bumped in the first place? @camilamacedo86

Copy link
Member

Choose a reason for hiding this comment

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

The motivation here is not bump to allow:

By keeping it on 1.17 we allow consumers of CR to use Go 1.17+.
But we are using go 1.18 in the ci, see: https://kubernetes.slack.com/archives/C02MRBMN00Z/p1652178727902549?thread_ts=1652177106.531319&cid=C02MRBMN00Z

+1 this approach has my support either.
and we should do the same in Kubebuilder.

Copy link
Member

Choose a reason for hiding this comment

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

/hold

@AlmogBaku
Copy link
Member

Thank you for your contribution @Vaxuite

I'm with @alvaroaleman here, I'm not sure if there's an immediate reason to update the go.mod's go version unless we do that on purpose to support go 1.18 features

@Vaxuite Vaxuite closed this May 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants