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

refactor: replace experimental maps and slices with stdlib #6179

Merged
merged 2 commits into from
Nov 25, 2024

Conversation

Juneezee
Copy link
Contributor

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 and maps.Values in the golang.org/x/exp package return a slice, whereas maps.Keys and maps.Values in the standard library return an iterator. To work with slices, we need to use slices.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

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 <[email protected]>
Copy link
Contributor

@jannotti jannotti left a 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!

data/transactions/logic/opcodes.go Outdated Show resolved Hide resolved
@jannotti jannotti self-assigned this Nov 25, 2024
Reference: #6179 (comment)
Signed-off-by: Eng Zer Jun <[email protected]>
@Juneezee Juneezee requested a review from jannotti November 25, 2024 18:12
@gmalouf gmalouf merged commit 92e0e00 into algorand:master Nov 25, 2024
17 checks passed
@gmalouf
Copy link
Contributor

gmalouf commented Nov 25, 2024

Thank you!

Copy link

codecov bot commented Nov 25, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 8 lines in your changes missing coverage. Please review.

Project coverage is 51.87%. Comparing base (0bc3d7e) to head (4742e34).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
daemon/algod/api/server/v2/utils.go 0.00% 6 Missing ⚠️
cmd/algokey/keyreg.go 0.00% 1 Missing ⚠️
netdeploy/network.go 0.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants