From c84c7250babc037b3d2f055d59d1a2b5dc08acf8 Mon Sep 17 00:00:00 2001 From: Zach Ramsay Date: Sat, 14 Oct 2017 14:38:47 -0400 Subject: [PATCH] linting: few more fixes --- Makefile | 2 +- rpc/lib/server/handlers.go | 5 +---- state/execution.go | 1 - types/vote_set_test.go | 13 ++----------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 848ca927e..628df93db 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,6 @@ metalinter_test: ensure_tools @gometalinter --install @gometalinter --vendor --deadline=600s --disable-all \ --enable=deadcode \ - --enable=errcheck \ --enable=gas \ --enable=gosimple \ --enable=ineffassign \ @@ -100,6 +99,7 @@ metalinter_test: ensure_tools #--enable=aligncheck \ #--enable=dupl \ + #--enable=errcheck \ #--enable=goconst \ #--enable=gocyclo \ #--enable=goimports \ diff --git a/rpc/lib/server/handlers.go b/rpc/lib/server/handlers.go index f47416641..98825be54 100644 --- a/rpc/lib/server/handlers.go +++ b/rpc/lib/server/handlers.go @@ -529,12 +529,9 @@ func (wsc *wsConnection) readRoutine() { wsc.WriteRPCResponse(types.RPCInternalError("unknown", err)) go wsc.readRoutine() } else { - if err := wsc.baseConn.Close(); err != nil { - panic(err) - } + wsc.baseConn.Close() // nolint: errcheck } }() - defer wsc.baseConn.Close() wsc.baseConn.SetPongHandler(func(m string) error { return wsc.baseConn.SetReadDeadline(time.Now().Add(wsc.readWait)) diff --git a/state/execution.go b/state/execution.go index 0c870095b..6c74f7a9e 100644 --- a/state/execution.go +++ b/state/execution.go @@ -293,7 +293,6 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) { } if err := s.TxIndexer.AddBatch(batch); err != nil { s.logger.Error("Error adding batch", "err", err) - panic(err) } } diff --git a/types/vote_set_test.go b/types/vote_set_test.go index ab2126cb7..ebead3eea 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -237,14 +237,10 @@ func Test2_3MajorityRedux(t *testing.T) { // 70th validator voted for different BlockHash { vote := withValidator(voteProto, privValidators[69].GetAddress(), 69) -<<<<<<< 026e76894f49dbfbd47601158c7e720b9545fd42 - signAddVote(privValidators[69], withBlockHash(vote, cmn.RandBytes(32)), voteSet) -======= - _, err := signAddVote(privValidators[69], withBlockHash(vote, RandBytes(32)), voteSet) + _, err := signAddVote(privValidators[69], withBlockHash(vote, cmn.RandBytes(32)), voteSet) if err != nil { t.Error(err) } ->>>>>>> linting: apply errcheck part1 blockID, ok = voteSet.TwoThirdsMajority() if ok || !blockID.IsZero() { t.Errorf("There should be no 2/3 majority: last vote added had different BlockHash") @@ -482,18 +478,13 @@ func TestMakeCommit(t *testing.T) { // 7th voted for some other block. { vote := withValidator(voteProto, privValidators[6].GetAddress(), 6) -<<<<<<< 026e76894f49dbfbd47601158c7e720b9545fd42 vote = withBlockHash(vote, cmn.RandBytes(32)) vote = withBlockPartsHeader(vote, PartSetHeader{123, cmn.RandBytes(32)}) - signAddVote(privValidators[6], vote, voteSet) -======= - vote = withBlockHash(vote, RandBytes(32)) - vote = withBlockPartsHeader(vote, PartSetHeader{123, RandBytes(32)}) + _, err := signAddVote(privValidators[6], vote, voteSet) if err != nil { t.Error(err) } ->>>>>>> linting: apply errcheck part1 } // The 8th voted like everyone else.