Skip to content

Commit

Permalink
linter: fix nolintlint warnings (#6257)
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Mar 19, 2021
1 parent dd84867 commit 6f6083d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions blockchain/v2/reactor_test.go
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion crypto/hash.go
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion crypto/merkle/proof_value.go
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion mempool/clist_mempool_test.go
Expand Up @@ -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))
}

Expand Down
2 changes: 1 addition & 1 deletion p2p/pex/addrbook.go
Expand Up @@ -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
}
6 changes: 3 additions & 3 deletions statesync/snapshots.go
Expand Up @@ -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
Expand Down

0 comments on commit 6f6083d

Please sign in to comment.