-
Notifications
You must be signed in to change notification settings - Fork 50
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
Replace golang.org/x/exp
with stdlib
#759
base: main
Are you sure you want to change the base?
Conversation
These experimental packages are now available in the Go standard library. 1. golang.org/x/exp/slices -> slices [1] 2. golang.org/x/exp/rand -> math/rand/v2 [2] golang.org/x/exp/rand has been deprecated and scheduled to be deleted [3]. [1]: https://go.dev/doc/go1.21#slices [2]: https://go.dev/doc/go1.22#math_rand_v2 [3]: golang/exp@f9890c6 Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Thanks for the contribution! I requested to stay with |
Reference: stateful#759 (review) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
Reference: stateful#759 (review) Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
It uses math/rand and LockedMonotonicReader internally, which is exactly the same code as ours. Reference: https://github.com/oklog/ulid/blob/v2.1.0/ulid.go#L132-L140 Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
@@ -60,7 +37,7 @@ func GenerateID() string { | |||
} | |||
|
|||
func DefaultGenerator() string { | |||
entropy := DefaultEntropy() | |||
entropy := ulid.DefaultEntropy() |
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.
After applying the code suggestion #759 (comment), I realize that we can use the DefaultEntropy()
function from github.com/oklog/ulid/v2
since it also uses math/rand
and LockedMonotonicReader
internally.
These experimental packages are now available in the Go standard library.
golang.org/x/exp/slices
->slices
(https://go.dev/doc/go1.21#slices)golang.org/x/exp/rand
->math/rand/v2
(https://go.dev/doc/go1.22#math_rand_v2)golang.org/x/exp/rand
has been deprecated and scheduled to be deleted.Reference: golang/exp@f9890c6