linter: (1/2) enable errcheck (#5064)

## Description

partially cleanup in preparation for errcheck

i ignored a bunch of defer errors in tests but with the update to go 1.14 we can use `t.Cleanup(func() { if err := <>; err != nil {..}}` to cover those errors, I will do this in pr number two of enabling errcheck.

ref #5059
This commit is contained in:
Marko
2020-07-01 15:13:11 +00:00
committed by GitHub
parent 8ec8385427
commit 7e2cc1db5e
35 changed files with 289 additions and 200 deletions
+6 -3
View File
@@ -178,7 +178,8 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
incompletePartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 2})
uncontiguousPartSet := types.NewPartSetFromHeader(types.PartSetHeader{Total: 0})
uncontiguousPartSet.AddPart(part2)
_, err := uncontiguousPartSet.AddPart(part2)
require.Error(t, err)
header1 := types.Header{
Height: 1,
@@ -303,7 +304,8 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
bBlockMeta := bs.LoadBlockMeta(tuple.block.Height)
if tuple.eraseSeenCommitInDB {
db.Delete(calcSeenCommitKey(tuple.block.Height))
err := db.Delete(calcSeenCommitKey(tuple.block.Height))
require.NoError(t, err)
}
if tuple.corruptSeenCommitInDB {
err := db.Set(calcSeenCommitKey(tuple.block.Height), []byte("bogus-seen-commit"))
@@ -313,7 +315,8 @@ func TestBlockStoreSaveLoadBlock(t *testing.T) {
commitHeight := tuple.block.Height - 1
if tuple.eraseCommitInDB {
db.Delete(calcBlockCommitKey(commitHeight))
err := db.Delete(calcBlockCommitKey(commitHeight))
require.NoError(t, err)
}
if tuple.corruptCommitInDB {
err := db.Set(calcBlockCommitKey(commitHeight), []byte("foo-bogus"))