linting: few more fixes

This commit is contained in:
Zach Ramsay 2017-10-14 14:38:47 -04:00 committed by Ethan Buchman
parent c7b6faf96a
commit c84c7250ba
4 changed files with 4 additions and 17 deletions

View File

@ -88,7 +88,6 @@ metalinter_test: ensure_tools
@gometalinter --install @gometalinter --install
@gometalinter --vendor --deadline=600s --disable-all \ @gometalinter --vendor --deadline=600s --disable-all \
--enable=deadcode \ --enable=deadcode \
--enable=errcheck \
--enable=gas \ --enable=gas \
--enable=gosimple \ --enable=gosimple \
--enable=ineffassign \ --enable=ineffassign \
@ -100,6 +99,7 @@ metalinter_test: ensure_tools
#--enable=aligncheck \ #--enable=aligncheck \
#--enable=dupl \ #--enable=dupl \
#--enable=errcheck \
#--enable=goconst \ #--enable=goconst \
#--enable=gocyclo \ #--enable=gocyclo \
#--enable=goimports \ #--enable=goimports \

View File

@ -529,12 +529,9 @@ func (wsc *wsConnection) readRoutine() {
wsc.WriteRPCResponse(types.RPCInternalError("unknown", err)) wsc.WriteRPCResponse(types.RPCInternalError("unknown", err))
go wsc.readRoutine() go wsc.readRoutine()
} else { } else {
if err := wsc.baseConn.Close(); err != nil { wsc.baseConn.Close() // nolint: errcheck
panic(err)
}
} }
}() }()
defer wsc.baseConn.Close()
wsc.baseConn.SetPongHandler(func(m string) error { wsc.baseConn.SetPongHandler(func(m string) error {
return wsc.baseConn.SetReadDeadline(time.Now().Add(wsc.readWait)) return wsc.baseConn.SetReadDeadline(time.Now().Add(wsc.readWait))

View File

@ -293,7 +293,6 @@ func (s *State) indexTxs(abciResponses *ABCIResponses) {
} }
if err := s.TxIndexer.AddBatch(batch); err != nil { if err := s.TxIndexer.AddBatch(batch); err != nil {
s.logger.Error("Error adding batch", "err", err) s.logger.Error("Error adding batch", "err", err)
panic(err)
} }
} }

View File

@ -237,14 +237,10 @@ func Test2_3MajorityRedux(t *testing.T) {
// 70th validator voted for different BlockHash // 70th validator voted for different BlockHash
{ {
vote := withValidator(voteProto, privValidators[69].GetAddress(), 69) vote := withValidator(voteProto, privValidators[69].GetAddress(), 69)
<<<<<<< 026e76894f49dbfbd47601158c7e720b9545fd42 _, err := signAddVote(privValidators[69], withBlockHash(vote, cmn.RandBytes(32)), voteSet)
signAddVote(privValidators[69], withBlockHash(vote, cmn.RandBytes(32)), voteSet)
=======
_, err := signAddVote(privValidators[69], withBlockHash(vote, RandBytes(32)), voteSet)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
>>>>>>> linting: apply errcheck part1
blockID, ok = voteSet.TwoThirdsMajority() blockID, ok = voteSet.TwoThirdsMajority()
if ok || !blockID.IsZero() { if ok || !blockID.IsZero() {
t.Errorf("There should be no 2/3 majority: last vote added had different BlockHash") 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. // 7th voted for some other block.
{ {
vote := withValidator(voteProto, privValidators[6].GetAddress(), 6) vote := withValidator(voteProto, privValidators[6].GetAddress(), 6)
<<<<<<< 026e76894f49dbfbd47601158c7e720b9545fd42
vote = withBlockHash(vote, cmn.RandBytes(32)) vote = withBlockHash(vote, cmn.RandBytes(32))
vote = withBlockPartsHeader(vote, PartSetHeader{123, 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) _, err := signAddVote(privValidators[6], vote, voteSet)
if err != nil { if err != nil {
t.Error(err) t.Error(err)
} }
>>>>>>> linting: apply errcheck part1
} }
// The 8th voted like everyone else. // The 8th voted like everyone else.