lint: add errchecks (#5316)

## Description

Work towards enabling errcheck

ref #5059
This commit is contained in:
Marko
2020-09-04 13:58:03 +02:00
committed by GitHub
parent 59ec3d91e4
commit b8d08b9ef4
43 changed files with 420 additions and 143 deletions

View File

@@ -190,7 +190,8 @@ func TestABCIQuery(t *testing.T) {
apph := bres.Height + 1 // this is where the tx will be applied to the state
// wait before querying
client.WaitForHeight(c, apph, nil)
err = client.WaitForHeight(c, apph, nil)
require.NoError(t, err)
res, err := c.ABCIQuery("/key", k)
qres := res.Response
if assert.Nil(t, err) && assert.True(t, qres.IsOK()) {
@@ -624,7 +625,8 @@ func testBatchedJSONRPCCalls(t *testing.T, c *rpchttp.HTTP) {
require.Equal(t, *bresult2, *r2)
apph := tmmath.MaxInt64(bresult1.Height, bresult2.Height) + 1
client.WaitForHeight(c, apph, nil)
err = client.WaitForHeight(c, apph, nil)
require.NoError(t, err)
q1, err := batch.ABCIQuery("/key", k1)
require.NoError(t, err)

View File

@@ -349,7 +349,10 @@ func (c *WSClient) reconnectRoutine() {
c.wg.Wait()
if err := c.reconnect(); err != nil {
c.Logger.Error("failed to reconnect", "err", err, "original_err", originalError)
c.Stop()
if err = c.Stop(); err != nil {
c.Logger.Error("failed to stop conn", "error", err)
}
return
}
// drain reconnectAfter

View File

@@ -99,7 +99,9 @@ func (wm *WebsocketManager) WebsocketHandler(w http.ResponseWriter, r *http.Requ
wm.logger.Error("Failed to start connection", "err", err)
return
}
con.Stop()
if err := con.Stop(); err != nil {
wm.logger.Error("error while stopping connection", "error", err)
}
}
///////////////////////////////////////////////////////////////////////////////