containerd / continuity

A transport-agnostic, filesystem metadata manifest system
https://containerd.io
Apache License 2.0
145 stars 67 forks source link

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

Closed henry118 closed 1 year ago

henry118 commented 1 year ago

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