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

On Go 1.21, use clear() to clear sets #289

Merged
merged 1 commit into from
Nov 21, 2023

Conversation

skitt
Copy link
Member

@skitt skitt commented Aug 16, 2023

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

The main motivation behind this PR is to be able to use the clear() function added in Go 1.21 to clear sets.

The PR also enables Go 1.21 in CI and drops 1.19 which is EOL.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Aug 16, 2023
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Aug 16, 2023
set/set.go Outdated
for key := range s {
delete(s, key)
}
clear(s)
Copy link
Member

Choose a reason for hiding this comment

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

If you make two files for this function, one pre-go1.21 and one go1.21+, this could merge sooner

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, the same thought occurred to me ;-).

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Aug 16, 2023
@skitt skitt changed the title Bump to Go 1.21 and use clear() to clear sets On Go 1.21, use clear() to clear sets Aug 16, 2023
@skitt skitt requested a review from liggitt September 13, 2023 13:43
@skitt
Copy link
Member Author

skitt commented Nov 20, 2023

@liggitt any chance for a re-review?

@liggitt
Copy link
Member

liggitt commented Nov 20, 2023

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 20, 2023
@liggitt
Copy link
Member

liggitt commented Nov 20, 2023

/hold mind squashing this to a single commit?

@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 Nov 20, 2023
This addresses the edge cases where a set couldn't be fully cleared,
and will be more efficient in cases where the loop isn't optimised
away.

To allow this to be tested in CI, configure tests with Go 1.20 and
1.21 (since 1.21 has been released, 1.19 has reached EOL).

Signed-off-by: Stephen Kitt <skitt@redhat.com>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 21, 2023
@skitt
Copy link
Member Author

skitt commented Nov 21, 2023

/hold mind squashing this to a single commit?

Done!

@liggitt
Copy link
Member

liggitt commented Nov 21, 2023

/hold cancel
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Nov 21, 2023
@skitt
Copy link
Member Author

skitt commented Nov 21, 2023

/assign @thockin

Copy link
Member

@thockin thockin left a comment

Choose a reason for hiding this comment

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

Thanks!

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: liggitt, skitt, thockin

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 Nov 21, 2023
@k8s-ci-robot k8s-ci-robot merged commit cf03d44 into kubernetes:master Nov 21, 2023
10 checks passed
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. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants