chore: bump golangci-lint and fix all linting issues (#21761)
This commit is contained in:
+12
-12
@@ -14,13 +14,13 @@ import (
|
||||
// merkleMap defines a merkle-ized tree from a map. Leave values are treated as
|
||||
// hash(key) | hash(value). Leaves are sorted before Merkle hashing.
|
||||
type merkleMap struct {
|
||||
kvs kv.Pairs
|
||||
kvs kv.Pairs //nolint:staticcheck // We are in store v1.
|
||||
sorted bool
|
||||
}
|
||||
|
||||
func newMerkleMap() *merkleMap {
|
||||
return &merkleMap{
|
||||
kvs: kv.Pairs{},
|
||||
kvs: kv.Pairs{}, //nolint:staticcheck // We are in store v1.
|
||||
sorted: false,
|
||||
}
|
||||
}
|
||||
@@ -38,7 +38,7 @@ func (sm *merkleMap) set(key string, value []byte) {
|
||||
// and make a determination to fetch or not.
|
||||
vhash := sha256.Sum256(value)
|
||||
|
||||
sm.kvs.Pairs = append(sm.kvs.Pairs, kv.Pair{
|
||||
sm.kvs.Pairs = append(sm.kvs.Pairs, kv.Pair{ //nolint:staticcheck // We are in store v1.
|
||||
Key: byteKey,
|
||||
Value: vhash[:],
|
||||
})
|
||||
@@ -61,7 +61,7 @@ func (sm *merkleMap) sort() {
|
||||
|
||||
// hashKVPairs hashes a kvPair and creates a merkle tree where the leaves are
|
||||
// byte slices.
|
||||
func hashKVPairs(kvs kv.Pairs) []byte {
|
||||
func hashKVPairs(kvs kv.Pairs) []byte { //nolint:staticcheck // We are in store v1.
|
||||
kvsH := make([][]byte, len(kvs.Pairs))
|
||||
for i, kvp := range kvs.Pairs {
|
||||
kvsH[i] = KVPair(kvp).Bytes()
|
||||
@@ -76,13 +76,13 @@ func hashKVPairs(kvs kv.Pairs) []byte {
|
||||
// Leaves are `hash(key) | hash(value)`.
|
||||
// Leaves are sorted before Merkle hashing.
|
||||
type simpleMap struct {
|
||||
Kvs kv.Pairs
|
||||
Kvs kv.Pairs //nolint:staticcheck // We are in store v1.
|
||||
sorted bool
|
||||
}
|
||||
|
||||
func newSimpleMap() *simpleMap {
|
||||
return &simpleMap{
|
||||
Kvs: kv.Pairs{},
|
||||
Kvs: kv.Pairs{}, //nolint:staticcheck // We are in store v1.
|
||||
sorted: false,
|
||||
}
|
||||
}
|
||||
@@ -99,7 +99,7 @@ func (sm *simpleMap) Set(key string, value []byte) {
|
||||
// and make a determination to fetch or not.
|
||||
vhash := sha256.Sum256(value)
|
||||
|
||||
sm.Kvs.Pairs = append(sm.Kvs.Pairs, kv.Pair{
|
||||
sm.Kvs.Pairs = append(sm.Kvs.Pairs, kv.Pair{ //nolint:staticcheck // We are in store v1.
|
||||
Key: byteKey,
|
||||
Value: vhash[:],
|
||||
})
|
||||
@@ -122,10 +122,10 @@ func (sm *simpleMap) Sort() {
|
||||
|
||||
// KVPairs returns a copy of sorted KVPairs.
|
||||
// NOTE these contain the hashed key and value.
|
||||
func (sm *simpleMap) KVPairs() kv.Pairs {
|
||||
func (sm *simpleMap) KVPairs() kv.Pairs { //nolint:staticcheck // We are in store v1.
|
||||
sm.Sort()
|
||||
kvs := kv.Pairs{
|
||||
Pairs: make([]kv.Pair, len(sm.Kvs.Pairs)),
|
||||
kvs := kv.Pairs{ //nolint:staticcheck // We are in store v1.
|
||||
Pairs: make([]kv.Pair, len(sm.Kvs.Pairs)), //nolint:staticcheck // We are in store v1.
|
||||
}
|
||||
|
||||
copy(kvs.Pairs, sm.Kvs.Pairs)
|
||||
@@ -137,12 +137,12 @@ func (sm *simpleMap) KVPairs() kv.Pairs {
|
||||
// KVPair is a local extension to KVPair that can be hashed.
|
||||
// Key and value are length prefixed and concatenated,
|
||||
// then hashed.
|
||||
type KVPair kv.Pair
|
||||
type KVPair kv.Pair //nolint:staticcheck // We are in store v1.
|
||||
|
||||
// NewKVPair takes in a key and value and creates a kv.Pair
|
||||
// wrapped in the local extension KVPair
|
||||
func NewKVPair(key, value []byte) KVPair {
|
||||
return KVPair(kv.Pair{
|
||||
return KVPair(kv.Pair{ //nolint:staticcheck // We are in store v1.
|
||||
Key: key,
|
||||
Value: value,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user