Fix errcheck lint failures with proper error handling
check / check (push) Successful in 1m42s

Handle every error return flagged by golangci-lint's errcheck rather
than discarding it:

- run.go: add a cleanup() helper that logs a warning (and ignores
  ErrNotExist) when removing a temp file fails, so leaked scratch files
  are surfaced; use it for all best-effort removals.
- copy.go / extract.go: log a warning on deferred Close() failures for
  the source file, destination DB, and result-set rows.
- extract.go: on the rollback path, ignore the benign sql.ErrTxDone
  (already committed) and log any other rollback failure.
- verify.go: add killCat() which ignores os.ErrProcessDone (zstdcat
  already exited via SIGPIPE) and logs any unexpected kill failure.

make check is clean (0 lint issues, tests pass).
This commit is contained in:
2026-06-28 10:25:47 +02:00
parent 8845f0ade6
commit a256b83734
4 changed files with 59 additions and 18 deletions
+5 -1
View File
@@ -21,7 +21,11 @@ func CopyFile(src, dst string) (err error) {
if err != nil {
return fmt.Errorf("opening source %s: %w", src, err)
}
defer srcFile.Close()
defer func() {
if cerr := srcFile.Close(); cerr != nil {
slog.Warn("failed to close source file", "src", src, "error", cerr)
}
}()
srcInfo, err := srcFile.Stat()
if err != nil {