ADR-010: Testing, Linting, and Code Quality
Date: 2025-05-01
Status
Section titled “Status”Accepted
Context
Section titled “Context”A robust testing and code quality strategy is essential for reliability and maintainability. The team needs to standardize on tools and patterns for Go code quality, testing, and CI.
Decision
Section titled “Decision”- Use Go’s built-in
testingpackage for all tests. - Favor table-driven tests for handler and utility logic.
- Use integration tests for database flows.
- Add
golangci-lintfor linting, and enforcegofmtfor formatting. - Run tests and linting in CI (see Taskfile and GitHub Actions).
Consequences
Section titled “Consequences”- Codebase is more robust and maintainable.
- Onboarding is easier for new devs.
- CI failures catch issues before production.
Enforcement
Section titled “Enforcement”- Testable consequences:
- TC-1:
golangci-lint run ./...passes. - TC-2: All Go files are gofmt-clean.
- TC-3:
go testruns in the gate with race detection and coverage.
- TC-1:
- Checks:
- TC-1 →
task lintintask ci(status: block, pre-existing) - TC-2 →
task fmt:checkintask ci(status: block, pre-existing) - TC-3 →
go test -race -covermode=atomicintask ci(status: block, pre-existing)
- TC-1 →
- Not machine-checkable: Table-driven style preference and integration-test judgment (see ADR-023).
- Graduation log: (empty)