Skip to content

Update to Go 1.23#13546

Merged
mattfarina merged 2 commits intohelm:mainfrom
mattfarina:bump-go-1.23
Dec 19, 2024
Merged

Update to Go 1.23#13546
mattfarina merged 2 commits intohelm:mainfrom
mattfarina:bump-go-1.23

Conversation

@mattfarina
Copy link
Copy Markdown
Collaborator

Multiple changes were made to pass linting. Some Go built-in names are being used for variables (e.g., min). This happens in the Go source itself including the Go standard library and is not always a bad practice.

To handle allowing some built-in names to be used the linter config is updated to allow (via opt-in) some names to pass. This allows us to still check for re-use of Go built-in names and opt-in to any new uses.

There were also several cases where a value was checked for nil before checking its length when this is already handled by len() or the types default value. These were cleaned up.

The license validation was updated because it was checking everything in the .git directory including all remote content that was local. The previous vendor directory was from a time prior to Go modules when Helm handled dependencies differently. It was no longer needed.

What this PR does / why we need it: This is needed to update to the latest k8s packages as they require Go 1.23

Special notes for your reviewer: Most of the changes are to handling new linting messages when Go was updated.

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

Multiple changes were made to pass linting. Some Go built-in names
are being used for variables (e.g., min). This happens in the Go
source itself including the Go standard library and is not always
a bad practice.

To handle allowing some built-in names to be used the linter config
is updated to allow (via opt-in) some names to pass. This allows us
to still check for re-use of Go built-in names and opt-in to any
new uses.

There were also several cases where a value was checked for nil
before checking its length when this is already handled by len()
or the types default value. These were cleaned up.

The license validation was updated because it was checking everything
in the .git directory including all remote content that was local.
The previous vendor directory was from a time prior to Go modules
when Helm handled dependencies differently. It was no longer needed.

Signed-off-by: Matt Farina <matt.farina@suse.com>
@mattfarina mattfarina added the Needs v3 backport Label PRs for v4/main, which are still applicable to v3 so need a separate backport PR label Dec 19, 2024
@mattfarina mattfarina added this to the 3.17.0 milestone Dec 19, 2024
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Dec 19, 2024
@robertsirc
Copy link
Copy Markdown
Member

Linting is failing.

Signed-off-by: Matt Farina <matt.farina@suse.com>
Copy link
Copy Markdown
Member

@robertsirc robertsirc left a comment

Choose a reason for hiding this comment

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

The vast majority of this is to upgrade us to Go 1.23, I do have a question about changes to some conditional if statements.

case *batchv1.Job:
selector, err = metav1.LabelSelectorAsSelector(t.Spec.Selector)
case *corev1.Service:
if t.Spec.Selector == nil || len(t.Spec.Selector) == 0 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are we ok with removing the check if spec selector is nil? will this break functionality?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

t.Spec.Selector is of type map[string]string. When there is nothing in the slice (the default value) len should return 0.

The linter catching these is the reason I changed them.

@mattfarina mattfarina merged commit e4c8da3 into helm:main Dec 19, 2024
@mattfarina mattfarina deleted the bump-go-1.23 branch December 19, 2024 19:16
@mattfarina mattfarina added v3 port complete For completed v2->v3 ports and removed Needs v3 backport Label PRs for v4/main, which are still applicable to v3 so need a separate backport PR labels Dec 30, 2024
@scottrigby scottrigby modified the milestones: 3.17.0, 4.0.0 Nov 5, 2025
@scottrigby scottrigby mentioned this pull request Nov 5, 2025
3 tasks
@scottrigby scottrigby modified the milestones: 4.0.0, 3.17.0 Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor size/M Denotes a PR that changes 30-99 lines, ignoring generated files. v3 port complete For completed v2->v3 ports

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants