Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lint errors #109

Merged
merged 2 commits into from
Nov 10, 2024
Merged

Fix lint errors #109

merged 2 commits into from
Nov 10, 2024

Conversation

prashantv
Copy link
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 on lines 1213 to 1214
//nolint:errcheck // logging writes are best-effort
fmt.Fprintln(w, s)
Copy link
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 on lines 1218 to 1219
//nolint:errcheck // logging writes are best-effort
fmt.Fprintf(w, format, a...)
Copy link
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
13 checks passed
@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