-
Notifications
You must be signed in to change notification settings - Fork 201
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
Conversation
dfed3d4
to
df88184
Compare
set/set.go
Outdated
for key := range s { | ||
delete(s, key) | ||
} | ||
clear(s) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ;-).
df88184
to
211c090
Compare
211c090
to
167c46a
Compare
@liggitt any chance for a re-review? |
/lgtm |
/hold mind squashing this to a single commit? |
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>
167c46a
to
571d869
Compare
Done! |
/hold cancel |
/assign @thockin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
/lgtm
/approve
[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 |
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: