Skip to content

Commit

Permalink
chore: fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Nov 16, 2023
1 parent 5c09581 commit 1f5dfae
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
9 changes: 6 additions & 3 deletions pkg/util/fr32/fr32_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ func TestPadChunkRandEqFFI(t *testing.T) {
tf.UnitTest(t)
for i := 0; i < 200; i++ {
var input [127]byte
rand.Read(input[:])
_, err := rand.Read(input[:])
require.NoError(t, err)

var buf [128]byte

Expand Down Expand Up @@ -113,7 +114,8 @@ func TestRoundtripChunkRand(t *testing.T) {
tf.UnitTest(t)
for i := 0; i < 200; i++ {
var input [127]byte
rand.Read(input[:])
_, err := rand.Read(input[:])
require.NoError(t, err)

var buf [128]byte
copy(buf[:], input[:])
Expand All @@ -132,7 +134,8 @@ func TestRoundtrip16MRand(t *testing.T) {
up := abi.PaddedPieceSize(16 << 20).Unpadded()

input := make([]byte, up)
rand.Read(input[:])
_, err := rand.Read(input[:])
require.NoError(t, err)

buf := make([]byte, 16<<20)

Expand Down
9 changes: 7 additions & 2 deletions venus-shared/testutil/value_provider_primitive.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package testutil

import (
crand "crypto/rand"
"encoding/hex"
"math/rand"
"testing"

"github.com/stretchr/testify/require"
)

func init() {
Expand Down Expand Up @@ -33,15 +36,17 @@ func IntRangedProvider(min, max int) func(*testing.T) int {
func BytesFixedProvider(size int) func(*testing.T) []byte {
return func(t *testing.T) []byte {
b := make([]byte, size)
rand.Read(b[:])
_, err := crand.Read(b[:])
require.NoError(t, err)
return b
}
}

func BytesAtMostProvider(size int) func(*testing.T) []byte {
return func(t *testing.T) []byte {
b := make([]byte, rand.Intn(size))
rand.Read(b[:])
_, err := crand.Read(b[:])
require.NoError(t, err)
return b
}
}
Expand Down

0 comments on commit 1f5dfae

Please sign in to comment.