Update lintci and fix lints (#1217)

This commit is contained in:
Manav Darji 2024-04-12 18:52:17 +05:30 committed by GitHub
parent a31a41d47a
commit ffe810e55a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 9 additions and 14 deletions

View file

@ -6,8 +6,6 @@ run:
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
skip-files:
- core/genesis_alloc.go
linters:
disable-all: true
@ -44,6 +42,8 @@ linters-settings:
min-occurrences: 6 # minimum number of occurrences
issues:
exclude-files:
- core/genesis_alloc.go
exclude-rules:
- path: crypto/bn256/cloudflare/optate.go
linters:

View file

@ -80,7 +80,7 @@ lint:
lintci-deps:
rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.53.3
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.57.2
goimports:
goimports -local "$(PACKAGE)" -w .

View file

@ -18,6 +18,7 @@ package legacypool
import (
"crypto/ecdsa"
crand "crypto/rand"
"errors"
"fmt"
"io"
@ -30,7 +31,7 @@ import (
"time"
"github.com/holiman/uint256"
"github.com/maticnetwork/crand"
crand2 "github.com/maticnetwork/crand"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
@ -115,7 +116,7 @@ func pricedTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ec
func pricedDataTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ecdsa.PrivateKey, bytes uint64) *types.Transaction {
data := make([]byte, bytes)
rand.Read(data)
crand.Read(data)
tx, _ := types.SignTx(types.NewTransaction(nonce, common.Address{}, big.NewInt(0), gaslimit, gasprice, data), types.HomesteadSigner{}, key)
@ -3801,7 +3802,7 @@ func BenchmarkBigs(b *testing.B) {
var over bool
for i := 0; i < len(ints); i++ {
ints[i] = crand.BigInt(max)
ints[i] = crand2.BigInt(max)
intUs[i], over = uint256.FromBig(ints[i])
if over {

View file

@ -26,11 +26,5 @@ import (
// byteArrayBytes returns a slice of the byte array v.
func byteArrayBytes(v reflect.Value, length int) []byte {
var s []byte
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s))
hdr.Data = v.UnsafeAddr()
hdr.Cap = length
hdr.Len = length
return s
return unsafe.Slice((*byte)(unsafe.Pointer(v.UnsafeAddr())), length)
}