chore: clear golangci-lint findings in production code
Summary
Fixes all 14 golangci-lint errcheck findings and 1 staticcheck finding in production (non-test) Go files. Test-file findings (31 remaining) are handled in a follow-up MR that also flips allow_failure: false.
Before: 45 total findings (41 errcheck, 4 staticcheck) After: 31 findings — 0 in production files, 31 in test files (expected, next MR)
Findings fixed
| File | Line | Linter | Resolution |
|---|---|---|---|
cmd/manifold/run.go |
95, 101 | errcheck | defer os.RemoveAll → defer func() { _ = os.RemoveAll(...) }() — best-effort temp-dir cleanup |
cmd/manifold/seed.go |
41 | errcheck | fmt.Scanln → _, _ = fmt.Scanln(...) — best-effort interactive prompt read |
internal/analyzer/analyze.go |
27, 28, 32, 33, 37 | errcheck | tmp.Close / os.Remove in error paths → _ = — best-effort cleanup before returning primary error |
internal/analyzer/analyze.go |
359 | errcheck | defer f.Close() on read-only file in readJSON → defer func() { _ = f.Close() }() |
internal/client/client.go |
488 | errcheck | io.Copy(io.Discard, ...) drain → _, _ = io.Copy(...) — best-effort connection reuse |
internal/collector/collector.go |
160–174 | errcheck | tmp.Close / os.Remove in error paths → _ = — best-effort cleanup |
internal/renderer/render.go |
177, 183 | errcheck | defer in.Close() / defer out.Close() → defer func() { _ = ... }() — read-only src; explicit flush close on line 188 is the real one |
internal/server/server.go |
47, 51 | errcheck | fmt.Fprint(w, ...) in HTTP handler → _, _ = fmt.Fprint(...) — client disconnect in handler is not actionable |
internal/config/config.go |
184 | staticcheck QF1003 | if ch == ' ' / else if ch == '\t' → tagged switch ch with labeled break indentLoop to preserve loop-exit semantics |
Validation
go vet ./...: passgo test -race ./...(CGO_ENABLED=1, Go 1.24.2): all 9 packages pass, no race conditionsgolangci-lint run(podman, v2.11.4): 0 production findings, 31 test-file findings (scope of next MR)allow_failure: trueon the CI lint job is unchanged — will be flipped in the follow-up MR