version: "2"
# errcheck stays ENABLED. We exclude only specific method signatures that are
# universally safe to ignore (defer close on read paths, rollback-after-commit,
# test helpers). Real production error paths must still be checked.
linters:
default: standard
settings:
errcheck:
exclude-functions:
# defer Close() on read-only or already-errored resources — the open
# error and read errors are what matter; close errors on these paths
# are non-actionable.
- (*database/sql.DB).Close
- (*database/sql.Rows).Close
- (*database/sql.Stmt).Close
# Rollback after a successful Commit is a no-op; rollback on the error
# path can't meaningfully recover either. Idiomatic pattern:
# `defer tx.Rollback()` right after `BeginTx`.
- (*database/sql.Tx).Rollback
# Our wrapper types around database/sql — same semantics as above.
- (*skraak/db.LoggedTx).Rollback
- (*skraak/db.LoggedStmt).Close
# Test cleanup — failures don't affect test validity.
- os.Remove
- os.RemoveAll
exclusions:
rules:
# Test files: binary.Write to in-memory buffers cannot fail; json.Unmarshal
# in assertions is checked by subsequent field reads; tx/stmt calls whose
# results are verified by later queries.
- path: _test\.go
linters:
- errcheck