chore: bump golangci-lint and fix all linting issues (#21761)
This commit is contained in:
@@ -107,9 +107,7 @@ func TestCreateHDPath(t *testing.T) {
|
||||
{"m/44'/114'/1'/1/0", args{114, 1, 1}, hd.BIP44Params{Purpose: 44, CoinType: 114, Account: 1, AddressIndex: 1}},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
tt := tt
|
||||
require.Equal(t, tt.want, *hd.CreateHDPath(tt.args.coinType, tt.args.account, tt.args.index))
|
||||
})
|
||||
}
|
||||
@@ -170,7 +168,6 @@ func TestDeriveHDPathRange(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.path, func(t *testing.T) {
|
||||
master, ch := hd.ComputeMastersFromSeed(seed)
|
||||
_, err := hd.DerivePrivateKeyForPath(master, ch, tt.path)
|
||||
@@ -297,7 +294,6 @@ func TestDerivePrivateKeyForPathDoNotCrash(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, path := range paths {
|
||||
path := path
|
||||
t.Run(path, func(t *testing.T) {
|
||||
_, _ = hd.DerivePrivateKeyForPath([32]byte{}, [32]byte{}, path)
|
||||
})
|
||||
|
||||
@@ -2003,7 +2003,7 @@ func TestRenameKey(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
|
||||
kr := newKeyring(t, "testKeyring")
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
tc.run(kr)
|
||||
|
||||
@@ -36,7 +36,6 @@ func TestNewSigningAlgoByString(t *testing.T) {
|
||||
|
||||
list := SigningAlgoList{hd.Secp256k1}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
algorithm, err := NewSigningAlgoFromString(tt.algoStr, list)
|
||||
if tt.isSupported {
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
"github.com/cometbft/cometbft/crypto"
|
||||
secp256k1dcrd "github.com/decred/dcrd/dcrec/secp256k1/v4"
|
||||
"gitlab.com/yawning/secp256k1-voi/secec"
|
||||
"golang.org/x/crypto/ripemd160" //nolint: staticcheck // keep around for backwards compatibility
|
||||
"golang.org/x/crypto/ripemd160" //nolint:staticcheck,gosec // keep around for backwards compatibility
|
||||
|
||||
errorsmod "cosmossdk.io/errors"
|
||||
|
||||
@@ -173,8 +173,8 @@ func (pubKey *PubKey) Address() crypto.Address {
|
||||
}
|
||||
|
||||
sha := sha256.Sum256(pubKey.Key)
|
||||
hasherRIPEMD160 := ripemd160.New()
|
||||
hasherRIPEMD160.Write(sha[:]) // does not error
|
||||
hasherRIPEMD160 := ripemd160.New() //nolint:gosec // keep around for backwards compatibility
|
||||
hasherRIPEMD160.Write(sha[:]) // does not error
|
||||
return crypto.Address(hasherRIPEMD160.Sum(nil))
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ func Test_genPrivKey(t *testing.T) {
|
||||
{"valid because 0 < 1 < N", validOne, false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
if tt.shouldPanic {
|
||||
require.Panics(t, func() {
|
||||
|
||||
@@ -255,7 +255,6 @@ func TestGenPrivKeyFromSecret(t *testing.T) {
|
||||
{"another seed used in cosmos tests #3", []byte("")},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
gotPrivKey := secp256k1.GenPrivKeyFromSecret(tt.secret)
|
||||
require.NotNil(t, gotPrivKey)
|
||||
|
||||
@@ -58,7 +58,6 @@ func TestBitArrayEqual(t *testing.T) {
|
||||
{name: "different should not be equal", b1: big1, b2: big2, eq: false},
|
||||
}
|
||||
for _, tc := range cases {
|
||||
tc := tc
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
eq := tc.b1.Equal(tc.b2)
|
||||
require.Equal(t, tc.eq, eq)
|
||||
@@ -102,7 +101,6 @@ func TestJSONMarshalUnmarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.bA.String(), func(t *testing.T) {
|
||||
bz, err := json.Marshal(tc.bA)
|
||||
require.NoError(t, err)
|
||||
@@ -162,7 +160,6 @@ func TestCompactMarshalUnmarshal(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.bA.String(), func(t *testing.T) {
|
||||
bz := tc.bA.CompactMarshal()
|
||||
|
||||
@@ -209,8 +206,6 @@ func TestCompactBitArrayNumOfTrueBitsBefore(t *testing.T) {
|
||||
{`"______________xx"`, []int{14, 15}, []int{0, 1}},
|
||||
}
|
||||
for tcIndex, tc := range testCases {
|
||||
tc := tc
|
||||
tcIndex := tcIndex
|
||||
t.Run(tc.marshalledBA, func(t *testing.T) {
|
||||
var bA *CompactBitArray
|
||||
err := json.Unmarshal([]byte(tc.marshalledBA), &bA)
|
||||
@@ -283,7 +278,6 @@ func TestNewCompactBitArrayCrashWithLimits(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
tt := tt
|
||||
t.Run(fmt.Sprintf("%d", tt.in), func(t *testing.T) {
|
||||
got := NewCompactBitArray(tt.in)
|
||||
if g := got != nil; g != tt.mustPass {
|
||||
|
||||
Reference in New Issue
Block a user