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
+1 -2
View File
@@ -28,7 +28,7 @@ func zipDir(src, dest string) error {
dirName := filepath.Base(dest)
baseDir := strings.TrimSuffix(dirName, filepath.Ext(dirName))
filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
return filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
@@ -69,7 +69,6 @@ func zipDir(src, dest string) error {
return err
})
return nil
}
// copyFile copies a file from src to dest and returns an error upon failure. The
@@ -58,7 +58,9 @@ func ResetAll(dbDir, addrBookFile, privValKeyFile, privValStateFile string, logg
logger.Error("Error removing all blockchain history", "dir", dbDir, "err", err)
}
// recreate the dbDir since the privVal state needs to live there
tmos.EnsureDir(dbDir, 0700)
if err := tmos.EnsureDir(dbDir, 0700); err != nil {
logger.Error("unable to recreate dbDir", "err", err)
}
resetFilePV(privValKeyFile, privValStateFile, logger)
}
+3 -1
View File
@@ -120,7 +120,9 @@ func NewRunNodeCmd(nodeProvider nm.Provider) *cobra.Command {
// Stop upon receiving SIGTERM or CTRL-C.
tmos.TrapSignal(logger, func() {
if n.IsRunning() {
n.Stop()
if err := n.Stop(); err != nil {
logger.Error("unable to stop the node", "error", err)
}
}
})