Skip to content

Fix lint errors - #109

Merged
prashantv merged 2 commits into
mainfrom
prashant/lint
Nov 10, 2024
Merged

prashantv merged 2 commits into
mainfrom
prashant/lint

Conversation

@prashantv

Copy link
Copy Markdown
Contributor

errtrace is flagging a few fmt.Fprint{f,ln} calls. Fix them by:

  • Adding error checks to writes that are required for functionality
  • Use separate log{f,ln} functions for non-required writes intended
    for logging, and ignore errors in the log functions.
  • Ignore write errors to fmt.State

errtrace is flagging a few fmt.Fprint{f,ln} calls. Fix them by:
 * Adding error checks to writes that are required for functionality
 * Use separate `log{f,ln}` functions for non-required writes intended
   for logging, and ignore errors in the log functions.
 * Ignore write errors to `fmt.State`
Comment thread cmd/errtrace/main.go Outdated
Comment on lines +1213 to +1214
//nolint:errcheck // logging writes are best-effort
fmt.Fprintln(w, s)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ignoring with _ is nicer than nolint, IMO

Suggested change
//nolint:errcheck // logging writes are best-effort
fmt.Fprintln(w, s)
_, _ = fmt.Fprintln(w, s) // logging writes are best-effort

Comment thread cmd/errtrace/main.go Outdated
Comment on lines +1218 to +1219
//nolint:errcheck // logging writes are best-effort
fmt.Fprintf(w, format, a...)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
//nolint:errcheck // logging writes are best-effort
fmt.Fprintf(w, format, a...)
_, _ = fmt.Fprintf(w, format, a...) // logging writes are best-effort

@prashantv
prashantv merged commit 00f8d50 into main Nov 10, 2024
@prashantv
prashantv deleted the prashant/lint branch November 10, 2024 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants