๐ Tier 1 ยท Orient
The Plan
From Go fundamentals to a shipped, production-shaped service in 6 weeks.
- 1
Values & errors
- Value vs. pointer semantics, zero values, structs
- Slices and maps and their cost models
- Errors as values: wrapping, errors.Is / errors.As
Deliverable: A CLI that reads input, transforms it, and reports failures with wrapped errors โ no panics on bad input.
- 2
Interfaces & composition
- Implicit satisfaction and small interfaces
- Accept interfaces, return structs
- Fakes for tests instead of mocks
Deliverable: Refactor week 1's CLI behind one or two small interfaces, with a hand-written fake that lets you test it with no real I/O.
- 3
Concurrency
- Goroutines, channels, select, context cancellation
- Mutexes vs. channels; the race detector
- Bounded concurrency with a worker pool
Deliverable: A concurrent fetch-and-process worker pool with context cancellation that passes `go test -race`.
- 4
HTTP service
- net/http ServeMux routing (1.22 patterns)
- Middleware, JSON encoding, and request context
- Graceful shutdown
Deliverable: A JSON API over net/http with logging middleware (log/slog) and a clean shutdown on SIGTERM.
- 5
Persistence & generics
- database/sql and a Postgres driver (pgx)
- Type-safe queries; a repository behind an interface
- A generic helper where it genuinely removes duplication
Deliverable: Back the API with a Postgres store behind a repository interface, plus one generic helper (e.g. a Map over rows) justified by โฅ2 uses.
- 6
Production hardening
- Table-driven tests and subtests; -race in CI
- A benchmark + a pprof pass to justify one optimization
- Multi-stage Docker build to a distroless image
Deliverable: Ship it: table-tested, race-clean in CI, one profiled-and-justified optimization, in a small distroless container.