lint: add errchecks (#5316)

## Description

Work towards enabling errcheck

ref #5059
This commit is contained in:
Marko
2020-09-04 11:58:03 +00:00
committed by GitHub
parent 59ec3d91e4
commit b8d08b9ef4
43 changed files with 420 additions and 143 deletions
+12 -4
View File
@@ -157,16 +157,24 @@ func (app *multiAppConn) killTMOnClientError() {
func (app *multiAppConn) stopAllClients() {
if app.consensusConnClient != nil {
app.consensusConnClient.Stop()
if err := app.consensusConnClient.Stop(); err != nil {
app.Logger.Error("error while stopping consensus client", "error", err)
}
}
if app.mempoolConnClient != nil {
app.mempoolConnClient.Stop()
if err := app.mempoolConnClient.Stop(); err != nil {
app.Logger.Error("error while stopping mempool client", "error", err)
}
}
if app.queryConnClient != nil {
app.queryConnClient.Stop()
if err := app.queryConnClient.Stop(); err != nil {
app.Logger.Error("error while stopping query client", "error", err)
}
}
if app.snapshotConnClient != nil {
app.snapshotConnClient.Stop()
if err := app.snapshotConnClient.Stop(); err != nil {
app.Logger.Error("error while stopping snapshot client", "error", err)
}
}
}
+7 -2
View File
@@ -35,7 +35,8 @@ func TestAppConns_Start_Stop(t *testing.T) {
time.Sleep(100 * time.Millisecond)
appConns.Stop()
err = appConns.Stop()
require.NoError(t, err)
clientMock.AssertExpectations(t)
}
@@ -71,7 +72,11 @@ func TestAppConns_Failure(t *testing.T) {
err := appConns.Start()
require.NoError(t, err)
defer appConns.Stop()
t.Cleanup(func() {
if err := appConns.Stop(); err != nil {
t.Error(err)
}
})
// simulate failure
close(quitCh)