fix(lint): resolve all errcheck warnings

Fix ~50 errcheck warnings across the codebase:

- Add explicit `_ =` for intentionally ignored error returns (cleanup,
  best-effort operations, etc.)
- Use `defer func() { _ = ... }()` pattern for defer statements
- Handle tmux SetEnvironment, KillSession, SendKeysRaw returns
- Handle mail router.Send returns
- Handle os.RemoveAll, os.Rename in cleanup paths
- Handle rand.Read returns for ID generation
- Handle fmt.Fprint* returns when writing to io.Writer
- Fix for-select with single case to use for-range
- Handle cobra MarkFlagRequired returns

All tests pass. Code compiles without errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 12:09:52 -08:00
parent 3a477f673c
commit 4048cdc373
29 changed files with 115 additions and 125 deletions

View File

@@ -141,7 +141,7 @@ func (r *Report) Print(w io.Writer, verbose bool) {
}
// Print summary
fmt.Fprintln(w)
_, _ = fmt.Fprintln(w)
r.printSummary(w)
}
@@ -157,18 +157,18 @@ func (r *Report) printCheck(w io.Writer, check *CheckResult, verbose bool) {
prefix = style.ErrorPrefix
}
fmt.Fprintf(w, "%s %s: %s\n", prefix, check.Name, check.Message)
_, _ = fmt.Fprintf(w, "%s %s: %s\n", prefix, check.Name, check.Message)
// Print details in verbose mode or for non-OK results
if len(check.Details) > 0 && (verbose || check.Status != StatusOK) {
for _, detail := range check.Details {
fmt.Fprintf(w, " %s\n", detail)
_, _ = fmt.Fprintf(w, " %s\n", detail)
}
}
// Print fix hint for errors/warnings
if check.FixHint != "" && check.Status != StatusOK {
fmt.Fprintf(w, " %s %s\n", style.ArrowPrefix, check.FixHint)
_, _ = fmt.Fprintf(w, " %s %s\n", style.ArrowPrefix, check.FixHint)
}
}
@@ -188,5 +188,5 @@ func (r *Report) printSummary(w io.Writer) {
parts = append(parts, style.Error.Render(fmt.Sprintf("%d errors", r.Summary.Errors)))
}
fmt.Fprintln(w, strings.Join(parts, ", "))
_, _ = fmt.Fprintln(w, strings.Join(parts, ", "))
}