lint: ensure errors are at least logged (errcheck)

Signed-off-by: Moritz Poldrack <moritz@poldrack.dev>
Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
Moritz Poldrack 2022-07-29 22:31:54 +02:00 committed by Robin Jarry
parent a8d631177f
commit 5ca6022d00
33 changed files with 301 additions and 103 deletions

View file

@ -36,7 +36,7 @@ func Debugf(message string, args ...interface{}) {
if len(args) > 0 {
message = fmt.Sprintf(message, args...)
}
dbg.Output(2, message)
dbg.Output(2, message) //nolint:errcheck // we can't do anything with what we log
}
func Infof(message string, args ...interface{}) {
@ -46,7 +46,7 @@ func Infof(message string, args ...interface{}) {
if len(args) > 0 {
message = fmt.Sprintf(message, args...)
}
info.Output(2, message)
info.Output(2, message) //nolint:errcheck // we can't do anything with what we log
}
func Warnf(message string, args ...interface{}) {
@ -56,7 +56,7 @@ func Warnf(message string, args ...interface{}) {
if len(args) > 0 {
message = fmt.Sprintf(message, args...)
}
warn.Output(2, message)
warn.Output(2, message) //nolint:errcheck // we can't do anything with what we log
}
func Errorf(message string, args ...interface{}) {
@ -66,5 +66,5 @@ func Errorf(message string, args ...interface{}) {
if len(args) > 0 {
message = fmt.Sprintf(message, args...)
}
err.Output(2, message)
err.Output(2, message) //nolint:errcheck // we can't do anything with what we log
}

View file

@ -42,7 +42,7 @@ func PanicHandler() {
fmt.Fprintln(panicLog, strings.Repeat("#", 80))
fmt.Fprintf(outputs, "%s\n", panicMessage)
fmt.Fprintf(panicLog, "Error: %v\n\n", r)
panicLog.Write(debug.Stack())
panicLog.Write(debug.Stack()) //nolint:errcheck // we are already in a panic, so not much we can do here
fmt.Fprintf(os.Stderr, "\nThis error was also written to: %s\n", filename)
panic(r)
}