first pass of corrections for golangci-lint

Signed-off-by: baude <bbaude@redhat.com>
This commit is contained in:
baude
2019-07-08 13:20:17 -05:00
parent 81e722d086
commit e053e0e05e
105 changed files with 456 additions and 406 deletions

View File

@ -0,0 +1,23 @@
package errorhandling
import (
"os"
"github.com/sirupsen/logrus"
)
// SyncQuiet syncs a file and logs any error. Should only be used within
// a defer.
func SyncQuiet(f *os.File) {
if err := f.Sync(); err != nil {
logrus.Errorf("unable to sync file %s: %q", f.Name(), err)
}
}
// CloseQuiet closes a file and logs any error. Should only be used within
// a defer.
func CloseQuiet(f *os.File) {
if err := f.Close(); err != nil {
logrus.Errorf("unable to close file %s: %q", f.Name(), err)
}
}