diff --git a/checksum/example_test.go b/checksum/example_test.go index d98c9921..337767ab 100644 --- a/checksum/example_test.go +++ b/checksum/example_test.go @@ -2,9 +2,9 @@ package checksum import ( "bytes" + "crypto/rand" "crypto/sha256" "fmt" - "math/rand" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" ) diff --git a/checksum/test/generate.go b/checksum/test/generate.go index d8c6b0bd..06c90599 100644 --- a/checksum/test/generate.go +++ b/checksum/test/generate.go @@ -1,8 +1,8 @@ package checksumtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/checksum" ) @@ -11,7 +11,7 @@ import ( func Checksum() checksum.Checksum { var cs [sha256.Size]byte - rand.Read(cs[:]) + _, _ = rand.Read(cs[:]) var x checksum.Checksum diff --git a/container/id/id_test.go b/container/id/id_test.go index ad122958..ded74572 100644 --- a/container/id/id_test.go +++ b/container/id/id_test.go @@ -1,8 +1,8 @@ package cid_test import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" diff --git a/container/id/test/id.go b/container/id/test/id.go index 2ebcf091..6790b226 100644 --- a/container/id/test/id.go +++ b/container/id/test/id.go @@ -1,8 +1,8 @@ package cidtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" ) @@ -11,7 +11,7 @@ import ( func ID() cid.ID { checksum := [sha256.Size]byte{} - rand.Read(checksum[:]) + _, _ = rand.Read(checksum[:]) return IDWithChecksum(checksum) } diff --git a/crypto/crypto_test.go b/crypto/crypto_test.go index 095cdd9b..7d1ad526 100644 --- a/crypto/crypto_test.go +++ b/crypto/crypto_test.go @@ -1,7 +1,7 @@ package frostfscrypto_test import ( - "math/rand" + "crypto/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" diff --git a/eacl/test/benchmark_test.go b/eacl/test/benchmark_test.go index cc2c3d00..865789b5 100644 --- a/eacl/test/benchmark_test.go +++ b/eacl/test/benchmark_test.go @@ -2,7 +2,7 @@ package eacltest import ( "bytes" - "math/rand" + "crypto/rand" "testing" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" diff --git a/eacl/validator_test.go b/eacl/validator_test.go index 3b8d9f18..582a6bc3 100644 --- a/eacl/validator_test.go +++ b/eacl/validator_test.go @@ -1,7 +1,7 @@ package eacl import ( - "math/rand" + "crypto/rand" "testing" "github.com/stretchr/testify/require" diff --git a/netmap/selector_test.go b/netmap/selector_test.go index ccb5eb2c..759e7eea 100644 --- a/netmap/selector_test.go +++ b/netmap/selector_test.go @@ -1,9 +1,10 @@ package netmap import ( + "crypto/rand" "encoding/binary" "fmt" - "math/rand" + mrand "math/rand" "sort" "strconv" "testing" @@ -28,10 +29,10 @@ func BenchmarkHRWSort(b *testing.B) { node.SetPublicKey(key) vectors[i] = nodes{node} - weights[i] = float64(rand.Uint32()%10) / 10.0 + weights[i] = float64(mrand.Uint32()%10) / 10.0 } - pivot := rand.Uint64() + pivot := mrand.Uint64() b.Run("sort by index, no weight", func(b *testing.B) { realNodes := make([]nodes, netmapSize) b.ResetTimer() diff --git a/netmap/test/generate.go b/netmap/test/generate.go index 3f5f26b8..19c3514b 100644 --- a/netmap/test/generate.go +++ b/netmap/test/generate.go @@ -1,7 +1,7 @@ package netmaptest import ( - "math/rand" + "crypto/rand" "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/netmap" ) @@ -70,7 +70,7 @@ func NetworkInfo() (x netmap.NetworkInfo) { // NodeInfo returns random netmap.NodeInfo. func NodeInfo() (x netmap.NodeInfo) { key := make([]byte, 33) - rand.Read(key) + _, _ = rand.Read(key) x.SetPublicKey(key) x.SetNetworkEndpoints("1", "2", "3") diff --git a/ns/nns_test.go b/ns/nns_test.go index 9970b885..669f4af8 100644 --- a/ns/nns_test.go +++ b/ns/nns_test.go @@ -1,10 +1,10 @@ package ns import ( + "crypto/rand" "errors" "fmt" "math/big" - "math/rand" "strings" "testing" diff --git a/object/id/test/generate.go b/object/id/test/generate.go index e51405d6..0da41199 100644 --- a/object/id/test/generate.go +++ b/object/id/test/generate.go @@ -1,8 +1,8 @@ package oidtest import ( + "crypto/rand" "crypto/sha256" - "math/rand" cidtest "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id/test" oid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object/id" @@ -12,7 +12,7 @@ import ( func ID() oid.ID { checksum := [sha256.Size]byte{} - rand.Read(checksum[:]) + _, _ = rand.Read(checksum[:]) return idWithChecksum(checksum) } diff --git a/object/search_test.go b/object/search_test.go index d0f36de5..40df23b5 100644 --- a/object/search_test.go +++ b/object/search_test.go @@ -1,8 +1,8 @@ package object_test import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" v2object "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/object" diff --git a/object/tombstone_test.go b/object/tombstone_test.go index cd74e456..98251333 100644 --- a/object/tombstone_test.go +++ b/object/tombstone_test.go @@ -1,8 +1,8 @@ package object import ( + "crypto/rand" "crypto/sha256" - "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/tombstone" diff --git a/session/container_test.go b/session/container_test.go index a152e316..d3d46626 100644 --- a/session/container_test.go +++ b/session/container_test.go @@ -1,9 +1,10 @@ package session_test import ( + "crypto/rand" "fmt" "math" - "math/rand" + mrand "math/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs" @@ -396,7 +397,7 @@ func TestContainer_AppliedTo(t *testing.T) { func TestContainer_InvalidAt(t *testing.T) { var x session.Container - nbf := rand.Uint64() + nbf := mrand.Uint64() if nbf == math.MaxUint64 { nbf-- } diff --git a/user/id_test.go b/user/id_test.go index 27d93dc8..30e19db4 100644 --- a/user/id_test.go +++ b/user/id_test.go @@ -1,7 +1,7 @@ package user_test import ( - "math/rand" + "crypto/rand" "testing" "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"