refactor: replace experimental maps and slices with stdlib#6179
Merged
gmalouf merged 2 commits intoalgorand:masterfrom Nov 25, 2024
Juneezee:refactor/experimental-maps-slices
Merged
refactor: replace experimental maps and slices with stdlib#6179gmalouf merged 2 commits intoalgorand:masterfrom Juneezee:refactor/experimental-maps-slices
maps and slices with stdlib#6179gmalouf merged 2 commits intoalgorand:masterfrom
Juneezee:refactor/experimental-maps-slices
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>
jannotti
requested changes
Nov 25, 2024
Contributor
jannotti
left a comment
There was a problem hiding this comment.
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>
jannotti
approved these changes
Nov 25, 2024
algorandskiy
approved these changes
Nov 25, 2024
Contributor
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.Keysandmaps.Valuesin thegolang.org/x/exppackage return a slice, whereasmaps.Keysandmaps.Valuesin the standard library return an iterator. To work with slices, we need to useslices.Collectto 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