-
Notifications
You must be signed in to change notification settings - Fork 490
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
refactor: replace experimental maps
and slices
with stdlib
#6179
refactor: replace experimental maps
and slices
with stdlib
#6179
Conversation
The experimental functions are now available in the standard library in Go 1.21 [1] and Go 1.23 [2]. [1]: https://go.dev/doc/go1.21#slices [2]: https://go.dev/doc/go1.23#new-unique-package Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
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.
Just one small change, to avoid having a variable called result
which is not the result for the function.
Thanks for doing this!
Reference: #6179 (comment) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Thank you! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6179 +/- ##
==========================================
+ Coverage 51.86% 51.87% +0.01%
==========================================
Files 639 639
Lines 85492 85489 -3
==========================================
+ Hits 44344 44351 +7
+ Misses 38331 38324 -7
+ Partials 2817 2814 -3 ☔ View full report in Codecov by Sentry. |
…and#6179) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Summary
Follow-up of #6169 (comment).
The experimental functions are now part of the standard library as of Go 1.21 and Go 1.23.
The key difference is that
maps.Keys
andmaps.Values
in thegolang.org/x/exp
package return a slice, whereasmaps.Keys
andmaps.Values
in the standard library return an iterator. To work with slices, we need to useslices.Collect
to convert the iterator into a slice.Reference: https://go.dev/doc/go1.21#slices
Reference: https://go.dev/doc/go1.23#new-unique-package
Test Plan
Go compiler