xuthus5 opened a new pull request, #1363: URL: https://github.com/apache/pulsar-client-go/pull/1363
### Motivation The Go 1.20 release deprecated the `rand.Seed` function, noting that programs should use the `rand.New(rand.NewSource(seed))` method instead. This change was made because using `rand.Seed` affects the global random number generator, which can lead to unexpected behavior in concurrent programs. By updating to the recommended API, we improve the code's forward compatibility and follow Go's best practices for random number generation. ### Modifications Replaced all occurrences of `rand.Seed(time.Now().UnixNano())` with `rand.New(rand.NewSource(time.Now().UnixNano()))` Updated variable assignments to use the new random generator instance where applicable Maintained the same seed behavior (using current nanosecond time) but now with proper instance isolation Verifying this change Make sure that the change passes the CI checks. This change is a trivial rework / code cleanup without any test coverage. The modification doesn't change the logical behavior of the code, only updates it to use the non-deprecated API. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
