all: fix math/rand deprecations

Change-Id: I4b966375697c0d409ce24cc7604f806973f8f22a
This commit is contained in:
Egon Elbre 2023-02-17 14:58:26 +02:00
parent aba2f14595
commit 0cdef95d55
8 changed files with 7 additions and 18 deletions

View File

@ -6,6 +6,4 @@
package main
func raiseUlimits() {
return
}
func raiseUlimits() {}

View File

@ -4,7 +4,7 @@ set -e pipefail
dbx schema -d pgx -d sqlite3 multinodedb.dbx .
dbx golang -d pgx -d sqlite3 -p dbx -t templates multinodedb.dbx .
( printf '%s\n' '//lint:file-ignore U1000,ST1012 generated file'; cat multinodedb.dbx.go ) > multinodedb.dbx.go.tmp && mv multinodedb.dbx.go.tmp multinodedb.dbx.go
( printf '%s\n' '//lint:file-ignore U1000,ST1012,SA1019 generated file'; cat multinodedb.dbx.go ) > multinodedb.dbx.go.tmp && mv multinodedb.dbx.go.tmp multinodedb.dbx.go
gofmt -r "*sql.Tx -> tagsql.Tx" -w multinodedb.dbx.go
gofmt -r "*sql.Rows -> tagsql.Rows" -w multinodedb.dbx.go
perl -0777 -pi \

View File

@ -1,4 +1,4 @@
//lint:file-ignore U1000,ST1012 generated file
//lint:file-ignore U1000,ST1012,SA1019 generated file
// AUTOGENERATED BY storj.io/dbx
// DO NOT EDIT.

View File

@ -296,7 +296,6 @@ func TestGracefulExit_CopiedObjects(t *testing.T) {
// TestGracefulExit_Enqueue_And_DeleteAllFinishedTransferQueueItems_batch
// ensures that deletion works as expected using different batch sizes.
func TestGracefulExit_Enqueue_And_DeleteAllFinishedTransferQueueItems_batchsize(t *testing.T) {
rand.Seed(time.Now().UnixNano())
var testCases = []struct {
name string
batchSize int
@ -400,8 +399,6 @@ func generateExitedNodes(t *testing.T, ctx *testcontext.Context, db satellite.DB
// the CRDB batch logic for delete all the transfer queue items of exited nodes
// works as expected.
func TestGracefulExit_DeleteAllFinishedTransferQueueItems_batch(t *testing.T) {
rand.Seed(time.Now().UnixNano())
satellitedbtest.Run(t, func(ctx *testcontext.Context, t *testing.T, db satellite.DB) {
const (
addr = "127.0.1.0:8080"

View File

@ -160,7 +160,6 @@ func testorderHealthyPieces(t *testing.T, connStr string) {
{uuid.UUID{'h'}, 10, time.Now().Add(-8 * time.Hour)},
}
// shuffle list since select order should not depend on insert order
rand.Seed(time.Now().UnixNano())
rand.Shuffle(len(injuredSegList), func(i, j int) {
injuredSegList[i], injuredSegList[j] = injuredSegList[j], injuredSegList[i]
})

View File

@ -5,7 +5,6 @@ go 1.18
replace storj.io/storj => ../../
require (
github.com/spacemonkeygo/monkit/v3 v3.0.19
github.com/stretchr/testify v1.8.0
github.com/zeebo/errs v1.3.0
go.uber.org/zap v1.21.0
@ -108,6 +107,7 @@ require (
github.com/segmentio/backo-go v0.0.0-20200129164019-23eae7c10bd3 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spacemonkeygo/monkit/v3 v3.0.19 // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spf13/cobra v1.1.3 // indirect
github.com/spf13/pflag v1.0.5 // indirect

View File

@ -9,7 +9,6 @@ import (
"testing"
"time"
"github.com/spacemonkeygo/monkit/v3"
"github.com/zeebo/errs"
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
@ -29,8 +28,6 @@ import (
"storj.io/uplink"
)
var mon = monkit.Package()
// Stack contains references to storjscan app and eth test network.
type Stack struct {
Log *zap.Logger

View File

@ -7,7 +7,6 @@ import (
"context"
"encoding/hex"
"io"
"math/rand"
"net/http"
"reflect"
"strings"
@ -18,6 +17,7 @@ import (
"golang.org/x/sync/errgroup"
"storj.io/common/testcontext"
"storj.io/common/testrand"
"storj.io/storj/versioncontrol"
)
@ -363,7 +363,7 @@ func randRollout(t *testing.T) versioncontrol.RolloutConfig {
return versioncontrol.RolloutConfig{
Seed: randSeedString(t),
Cursor: rand.Intn(101),
Cursor: testrand.Intn(101),
}
}
@ -371,8 +371,6 @@ func randSeedString(t *testing.T) string {
t.Helper()
seed := make([]byte, 32)
_, err := rand.Read(seed)
require.NoError(t, err)
testrand.Read(seed)
return hex.EncodeToString(seed)
}