lint: fix errcheck for fmt.Fprintf/Fprint across multiple files
Add lint.Fprint helper for unchecked fmt.Fprint calls. Use lint.Fprintf/Fprint in api/event.go, api/image.go, rmo/root.go. Add explicit error check for fmt.Fprintf in middleware/terminal.go cW.
This commit is contained in:
parent
934fb03ca2
commit
c7a7e8431c
5 changed files with 20 additions and 8 deletions
|
|
@ -59,9 +59,12 @@ func cW(w io.Writer, useColor bool, color []byte, s string, args ...interface{})
|
|||
return fmt.Errorf("write color: %w", err)
|
||||
}
|
||||
}
|
||||
fmt.Fprintf(w, s, args...)
|
||||
_, err := fmt.Fprintf(w, s, args...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("fprintf: %w", err)
|
||||
}
|
||||
if IsTTY && useColor {
|
||||
_, err := w.Write(reset)
|
||||
_, err = w.Write(reset)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write color: %w", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue