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

Substitute deprecated rand.Seed() in Go 1.20 #231

Merged
merged 1 commit into from Oct 12, 2023

Conversation

henry118
Copy link
Member

@henry118 henry118 commented Sep 9, 2023

rand.Seed is deprecated since Go 1.20.

Compiling this package with Go 1.20 resulted in the following linter error:

manifest_test.go:44:2: SA1019: rand.Seed has been deprecated since Go 1.20 and an alternative has been available since Go 1.0: Programs that call Seed and then expect a specific sequence of results from the global random source (using functions such as Int) can be broken when a dependency changes how much it consumes from the global random source. To avoid such breakages, programs that need a specific result sequence should use NewRand(NewSource(seed)) to obtain a random generator that other packages cannot access. (staticcheck)
rand.Seed(1)
^
make: *** [Makefile:48: lint] Error 1

Signed-off-by: Henry Wang <henwang@amazon.com>
@samuelkarp samuelkarp merged commit 022712c into containerd:main Oct 12, 2023
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants