-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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(libbeat): use math/rand/v2 and drop seed init #42025
Conversation
Since go 1.20 the rand package automatically seeds the global random number generator with a random value. remove deprecate methods and use rand v2 api in libbeat
This pull request doesn't have a |
This pull request does not have a backport label.
To fixup this pull request, you need to add the backport labels for the needed
|
|
it was removed in v4
func init() { | ||
initRand() | ||
} | ||
|
||
// initRand initializes the runtime random number generator seed using | ||
// global, shared cryptographically strong pseudo random number generator. | ||
// | ||
// On linux Reader might use getrandom(2) or /udev/random. On windows systems | ||
// CryptGenRandom is used. | ||
func initRand() { |
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.
Thank you for removing this. Even without the v2 changes this was unsound.
Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co>
* feat(libbeat): use math/rand/v2 and drop seed init Since go 1.20 the rand package automatically seeds the global random number generator with a random value. remove deprecate methods and use rand v2 api in libbeat * ci: bump golangci-lint to fix errors * ci(golangci): remove skip-go-installation option it was removed in v4 * Update golangci-lint.yml * Update golangci-lint.yml * Update golangci-lint.yml * lint: replace rand with t tempdir * Update client_integration_test.go * lint: fix linter issues * lint: fix linter issues * Apply suggestions from code review Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co> --------- Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co> (cherry picked from commit 12c36bd)
* feat(libbeat): use math/rand/v2 and drop seed init Since go 1.20 the rand package automatically seeds the global random number generator with a random value. remove deprecate methods and use rand v2 api in libbeat * ci: bump golangci-lint to fix errors * ci(golangci): remove skip-go-installation option it was removed in v4 * Update golangci-lint.yml * Update golangci-lint.yml * Update golangci-lint.yml * lint: replace rand with t tempdir * Update client_integration_test.go * lint: fix linter issues * lint: fix linter issues * Apply suggestions from code review Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co> --------- Co-authored-by: Dan Kortschak <dan.kortschak@elastic.co> (cherry picked from commit 12c36bd) Co-authored-by: kruskall <99559985+kruskall@users.noreply.github.com>
Proposed commit message
Since go 1.20 the rand package automatically seeds the global random number generator with a random value.
remove deprecate methods and use rand v2 api in libbeat
Checklist
CHANGELOG.next.asciidoc
orCHANGELOG-developer.next.asciidoc
.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs