code-review-russ-cox
code-review-russ-cox
Judge code by long-term maintenance cost: whether it should exist, whether it sits at the right layer, and whether its seams, errors, tests, and docs would pass the Go team's bar. Two modes — pick by input.
- Change review — input is a diff, PR, proposed feature, or new dependency: run the four passes.
- Package audit — input is existing code ("audit", "polish", "refactor", "what's wrong with this package"): read the target in full — doc comments, tests, and imports included — plus a sample of its callers, then walk the six dimensions. End with a refactor plan judged by what it deletes.
State the problem the code solves in one sentence before either mode. If you cannot, ask. In an established codebase, search for existing primitives before judging anything new — the most common finding is a helper, interface, or package that already does this.
Change review — four passes
- Feature creep — Does this solve a real problem that existing pieces cannot compose? Is the 5-year maintenance cost worth the user value?
- Wrong layer — Is this treating a symptom instead of fixing the layer that owns the behavior?
- Dependency explosion — What does the dependency actually do, what transitive cost arrives with it, and could 20-50 lines replace it? Heuristic: import what is hard, own what is core, copy what is small.
- Quality debt — Will a new maintainer understand it in six months, and is any debt paired with a concrete paydown trigger?
Package audit — six dimensions
These are principles, not a compliance checklist: translate each into the codebase's own language, ecosystem, and scale, and silently skip any dimension that doesn't apply (a CLI script has no seams to audit; a stateless lib has no long-running loops). Never write a finding that demands another project's idiom — name the principle and its local translation.