-
Notifications
You must be signed in to change notification settings - Fork 149
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
feat: Migrate to math/rand/v2 #553
Conversation
Please have a look @rueian ^_^ |
internal/util/rand.go
Outdated
return | ||
} | ||
|
||
func BinaryString() []byte { |
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.
On self-review, we could probably rename this
Open to suggestions
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.
Indeed. Maybe RandomBytes.
internal/util/rand.1.22.go
Outdated
rand.Shuffle(n, swap) | ||
} | ||
|
||
func IntN(n int) int { |
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.
until.IntN looks vague. I think we can just replace it with the below FastRand.
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.
We can do that, but for go !1.22
The regular usage of Intn would also be replaced with rngPool implementation, Should we do that? @rueian
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.
Yes, that is okay.
Addressed @rueian Pls take a look |
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. Almost done. We just need to group and sort imports.
om/json.go
Outdated
@@ -3,6 +3,7 @@ package om | |||
import ( | |||
"context" | |||
"encoding/json" | |||
"github.com/oklog/ulid/v2" |
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.
We should sort imports.
rueidis.go
Outdated
@@ -7,8 +7,8 @@ import ( | |||
"context" | |||
"crypto/tls" | |||
"errors" | |||
"github.com/redis/rueidis/internal/util" |
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.
We should sort imports.
"errors" | ||
"math/rand" | ||
"github.com/redis/rueidis/internal/util" | ||
"strconv" |
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.
We should sort imports.
sentinel.go
Outdated
@@ -5,15 +5,14 @@ import ( | |||
"context" | |||
"errors" | |||
"fmt" | |||
"github.com/redis/rueidis/internal/util" |
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.
We should sort imports.
@rueian Done, I guess this sorting should be okay |
Hi @SoulPancake, #554 has been merged. Could you rebase this PR? |
update master
Done @rueian |
@rueian Is this ready to be merged? |
Yes, this will be merged this weekend. |
Thanks @SoulPancake! |
Solves