This file is a short Go reference for this repository. It is not a native auto-loaded Codex filename.
AGENTS.md owns always-on policy.
.codex/skills/ owns workflow.
This file only captures concise language and API reminders.
- Use current-toolchain Go features when they improve clarity.
new(expr), iterators,strings.Lines,bytes.Lines,SplitSeq,t.Context,b.Loop,t.ArtifactDir,testing/synctest, andWaitGroup.Goare available in this repo's Go level.- Prefer allocation-saving and clarity-improving forms, not novelty for its own sake.
omitemptyandomitzeroare both available.- Tag changes are wire-format changes and must be reviewed as compatibility work.
- Nil vs empty slice/map behavior must be intentional.
- Keep zero value useful when practical.
- Prefer nil slices by default unless empty semantics are required.
- Use pointer receivers only when mutation/copy cost or invariants require it.
- Avoid copying mutex-containing types.
- Keep exported APIs stable and document behavior changes.
- Prefer explicit domain types (
UserID,SessionState) over rawstring/int.
- Package names: short, lowercase; avoid
util,common,helpers. - Initialisms:
ID,URL,HTTP,JSON,API,SQL. - No stutter in names (
orders.Service, notorders.OrderService). - Prefer domain-specific names and typed constants.
- Every exported name/package has a doc comment.
- Export docs should describe caller behavior, invariants, and assumptions.
- Add docs when config, wire format, or API semantics change.
- Subtest names should be readable.
- Failure messages should make
gotandwantobvious. - Prefer stdlib helpers or small purpose-built test helpers that fit the repo's zero-dependency policy.
- Use
t.Helper,t.Context(where available), andfor b.Loop()for new benchmarks. - Avoid brittle assertions on exact text unless contractually fixed.
- Use table-driven tests for variation-heavy behavior.
- Set explicit timeouts for network/db operations.
- Always close bodies/rows and check close/terminal errors.
- Parameterized queries only for SQL and explicit transactions where needed.
- Shutdown channels and context cancellation for background goroutines.
- No concurrent map writes without synchronization.
- Make concurrency behavior observable and testable without sleeps.
- Treat lint/staticcheck feedback as design feedback.
- Do not scatter ignores; fix root causes.
- Do not weaken lint rules as a default workaround.