Browse Source

linter: fix nolintlint warnings (#6257)

pull/6254/head
Callum Waters 4 years ago
committed by GitHub
parent
commit
6f6083dae3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 10 additions and 7 deletions
  1. +3
    -0
      blockchain/v2/reactor_test.go
  2. +1
    -1
      crypto/hash.go
  3. +1
    -1
      crypto/merkle/proof_value.go
  4. +1
    -1
      mempool/clist_mempool_test.go
  5. +1
    -1
      p2p/pex/addrbook.go
  6. +3
    -3
      statesync/snapshots.go

+ 3
- 0
blockchain/v2/reactor_test.go View File

@ -64,14 +64,17 @@ type mockBlockStore struct {
blocks map[int64]*types.Block
}
//nolint:unused
func (ml *mockBlockStore) Height() int64 {
return int64(len(ml.blocks))
}
//nolint:unused
func (ml *mockBlockStore) LoadBlock(height int64) *types.Block {
return ml.blocks[height]
}
//nolint:unused
func (ml *mockBlockStore) SaveBlock(block *types.Block, part *types.PartSet, commit *types.Commit) {
ml.blocks[block.Height] = block
}


+ 1
- 1
crypto/hash.go View File

@ -6,6 +6,6 @@ import (
func Sha256(bytes []byte) []byte {
hasher := sha256.New()
hasher.Write(bytes) //nolint:errcheck // ignore error
hasher.Write(bytes)
return hasher.Sum(nil)
}

+ 1
- 1
crypto/merkle/proof_value.go View File

@ -80,7 +80,7 @@ func (op ValueOp) Run(args [][]byte) ([][]byte, error) {
}
value := args[0]
hasher := tmhash.New()
hasher.Write(value) //nolint: errcheck // does not error
hasher.Write(value)
vhash := hasher.Sum(nil)
bz := new(bytes.Buffer)


+ 1
- 1
mempool/clist_mempool_test.go View File

@ -653,7 +653,7 @@ func newRemoteApp(
}
func checksumIt(data []byte) string {
h := sha256.New()
h.Write(data) //nolint: errcheck // ignore errcheck
h.Write(data)
return fmt.Sprintf("%x", h.Sum(nil))
}


+ 1
- 1
p2p/pex/addrbook.go View File

@ -941,6 +941,6 @@ func (a *addrBook) hash(b []byte) ([]byte, error) {
if err != nil {
return nil, err
}
hasher.Write(b) //nolint:errcheck // ignore error
hasher.Write(b)
return hasher.Sum(nil), nil
}

+ 3
- 3
statesync/snapshots.go View File

@ -33,9 +33,9 @@ type snapshot struct {
func (s *snapshot) Key() snapshotKey {
// Hash.Write() never returns an error.
hasher := sha256.New()
hasher.Write([]byte(fmt.Sprintf("%v:%v:%v", s.Height, s.Format, s.Chunks))) //nolint:errcheck // ignore error
hasher.Write(s.Hash) //nolint:errcheck // ignore error
hasher.Write(s.Metadata) //nolint:errcheck // ignore error
hasher.Write([]byte(fmt.Sprintf("%v:%v:%v", s.Height, s.Format, s.Chunks)))
hasher.Write(s.Hash)
hasher.Write(s.Metadata)
var key snapshotKey
copy(key[:], hasher.Sum(nil))
return key


Loading…
Cancel
Save