Write Go Code
Core Principles
- •Clarity over cleverness - Code should be obvious to readers
- •Simplicity - Accomplish goals in the most straightforward way
- •Consistency - Match surrounding code and project conventions
- •Minimal indentation - Handle errors early, keep happy path unindented
Workflow
- •Run automated checks (
make lint,make fmtorgofmt,goimports) - •Review against essential checklist:
references/essential/checklist.md - •For specific questions, consult:
references/comprehensive/{topic}.md
Reference Navigation
Quick reviews (default):
- •
references/essential/checklist.md- Condensed, actionable rules
Deep dives by topic:
- •
references/comprehensive/naming.md- Package names, identifiers, receivers - •
references/comprehensive/errors.md- Error handling, panic/recover - •
references/comprehensive/concurrency.md- Goroutines, channels, context - •
references/comprehensive/testing.md- Test quality and patterns - •
references/comprehensive/code-organization.md- Imports, packages, structure - •
references/comprehensive/data-types.md- new vs make, slices, maps - •
references/comprehensive/functions.md- Multiple returns, defer - •
references/comprehensive/interfaces.md- Embedding, type assertions