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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/continuity/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require (
require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 // indirect
golang.org/x/sys v0.1.0 // indirect
google.golang.org/protobuf v1.26.0 // indirect
)

Expand Down
2 changes: 2 additions & 0 deletions cmd/continuity/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ golang.org/x/sys v0.0.0-20191210023423-ac6580df4449/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461 h1:kHVeDEnfKn3T238CvrUcz6KeEsFHVaKh4kMTt6Wsysg=
golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0 h1:kunALQeHf1/185U1i0GOB/fy1IPRDDpuoOOqRReG57U=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20200423201157-2723c5de0d66/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
Expand Down
9 changes: 6 additions & 3 deletions manifest_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import (
// 3. ADS - no clue where to start.

func TestWalkFS(t *testing.T) {
rand.Seed(1)

// Testing:
// 1. Setup different files:
Expand Down Expand Up @@ -219,6 +218,10 @@ const (
rnamedpipe
)

var (
rng = rand.New(rand.NewSource(1))
)

type dresource struct {
kind kind
path string
Expand All @@ -236,7 +239,7 @@ func generateTestFiles(t *testing.T, root string, resources []dresource) {
p := filepath.Join(root, resource.path)
switch resource.kind {
case rfile:
size := rand.Intn(4 << 20)
size := rng.Intn(4 << 20)
d := make([]byte, size)
randomBytes(d)
dgst := digest.FromBytes(d)
Expand Down Expand Up @@ -312,7 +315,7 @@ func generateTestFiles(t *testing.T, root string, resources []dresource) {

func randomBytes(p []byte) {
for i := range p {
p[i] = byte(rand.Intn(1<<8 - 1))
p[i] = byte(rng.Intn(1<<8 - 1))
}
}

Expand Down