errcheck; sort some stuff out

This commit is contained in:
Zach Ramsay
2017-11-27 22:39:11 +00:00
committed by Ethan Buchman
parent 563faa98de
commit d7cb291fb2
26 changed files with 61 additions and 154 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ func TestByzantine(t *testing.T) {
conR.SetLogger(logger.With("validator", i))
conR.SetEventBus(eventBus)
var conRI p2p.Reactor // nolint (gotype)
var conRI p2p.Reactor // nolint: gotype
conRI = conR
if i == 0 {
+1 -6
View File
@@ -115,12 +115,7 @@ func (cs *ConsensusState) catchupReplay(csHeight int) error {
} else if err != nil {
return err
} else {
defer func() {
if err := gr.Close(); err != nil {
cs.Logger.Error("Error closing wal Search", "err", err)
return
}
}()
defer gr.Close() // nolint: errcheck
}
if !found {
return errors.New(cmn.Fmt("Cannot replay height %d. WAL does not contain #ENDHEIGHT for %d.", csHeight, csHeight-1))
+1 -5
View File
@@ -65,11 +65,7 @@ func (cs *ConsensusState) ReplayFile(file string, console bool) error {
}
pb := newPlayback(file, fp, cs, cs.state.Copy())
defer func() {
if err := pb.fp.Close(); err != nil {
cs.Logger.Error("Error closing new playback", "err", err)
}
}()
defer pb.fp.Close() // nolint: errcheck
var nextN int // apply N msgs in a row
var msg *TimedWALMessage
+1 -6
View File
@@ -490,12 +490,7 @@ func makeBlockchainFromWAL(wal WAL) ([]*types.Block, []*types.Commit, error) {
if !found {
return nil, nil, errors.New(cmn.Fmt("WAL does not contain height %d.", 1))
}
defer func() {
if err := gr.Close(); err != nil {
wal.Logger.Error("Error closing wal Search", "err", err)
return
}
}()
defer gr.Close()
// log.Notice("Build a blockchain by reading from the WAL")
+1 -1
View File
@@ -372,7 +372,7 @@ func (cs *ConsensusState) updateRoundStep(round int, step cstypes.RoundStepType)
// enterNewRound(height, 0) at cs.StartTime.
func (cs *ConsensusState) scheduleRound0(rs *cstypes.RoundState) {
//cs.Logger.Info("scheduleRound0", "now", time.Now(), "startTime", cs.StartTime)
sleepDuration := rs.StartTime.Sub(time.Now()) // nolint (gotype)
sleepDuration := rs.StartTime.Sub(time.Now()) // nolint: gotype
cs.scheduleTimeout(sleepDuration, rs.Height, 0, cstypes.RoundStepNewHeight)
}