From f2328b36b1aa32d04a0d98bb9e25bf2a1b60efa8 Mon Sep 17 00:00:00 2001 From: Gui Iribarren Date: Thu, 9 Mar 2023 13:17:58 -0300 Subject: [PATCH] fix staticcheck reports --- data/ipfs.go | 2 +- rpcclient/util.go | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/data/ipfs.go b/data/ipfs.go index cae978163..db5390ece 100644 --- a/data/ipfs.go +++ b/data/ipfs.go @@ -8,8 +8,8 @@ import ( "time" ipfscid "github.com/ipfs/go-cid" - files "github.com/ipfs/go-ipfs-files" keystore "github.com/ipfs/go-ipfs-keystore" + files "github.com/ipfs/go-libipfs/files" ipfslog "github.com/ipfs/go-log" coreiface "github.com/ipfs/interface-go-ipfs-core" "github.com/ipfs/interface-go-ipfs-core/options" diff --git a/rpcclient/util.go b/rpcclient/util.go index 6e1bf716a..1378a310e 100644 --- a/rpcclient/util.go +++ b/rpcclient/util.go @@ -1,10 +1,11 @@ package rpcclient import ( + "crypto/rand" "encoding/hex" "encoding/json" "fmt" - "math/rand" + "math/big" "os" "time" @@ -269,7 +270,11 @@ func genVote(encrypted bool, keys []string) ([]byte, error) { return nil, fmt.Errorf("cannot decode encryption key with index %d: (%s)", i, err) } if first { - vp.Nonce = RandomHex(rand.Intn(16) + 16) + randInt, err := rand.Int(rand.Reader, big.NewInt(16)) + if err != nil { + return nil, err + } + vp.Nonce = RandomHex(int(randInt.Int64()) + 16) vpBytes, err = json.Marshal(vp) if err != nil { return nil, err