Learn
Go Service Engineering
Build small Go services with clear context propagation, concurrency control, observability, and deployment discipline.
Level: Intermediate. Track: Reliable services. Audience: Developers moving from scripts or handlers into long-running services.
Capstone: A worker-backed API that processes jobs with context timeouts, logs, retries, and graceful shutdown.
Outcomes
- Build HTTP services with context propagation and consistent JSON errors.
- Use concurrency primitives without leaking work during shutdown.
- Release a small binary with storage, logs, tests, and race checks.
Stack
- Go
- net/http
- slog
- PostgreSQL
- Docker
Course sections
- Service shell and cancellation — Establish handlers, server timeouts, and context flow before adding persistence.
- Releasable Go service — Shape package boundaries, storage, workers, and release checks around operational reliability.
- Pro: operations and reliability — Make operational failures traceable, deploys bounded, health checks useful, and incident reviews concrete.
Professional roadmap
- Safe handler baseline — Create handlers with body limits, timeouts, context usage, and structured errors. Evidence: HTTP tests that cover malformed input and timeout-aware service calls.
- Bounded worker loop — Process background jobs with cancellation, deadlines, and logs. Evidence: A test that shuts the worker down deterministically.
- Release checks complete — Run unit tests, repository tests, and race checks before packaging. Evidence: Documented go test, race detector, and container build commands.
- Operable Go service — Connect stable error codes, request-scoped logs, readiness, graceful shutdown, and incident follow-up. Evidence: Error mapping tests, slog sample, shutdown proof, smoke script, and incident note.
Portfolio artifacts
- Go API binary
- Worker shutdown test
- Migration and repository layer
- Release checklist
- Operational error matrix
- Incident runbook
Lessons
- HTTP Service Basics — Build a small JSON API with standard handlers, structured errors, timeouts, and a simple project layout. 33 min.
- Context and Cancellation — Make timeouts and shutdown signals flow through every expensive operation. 34 min.
- Interfaces at Boundaries — Use interfaces where they describe ownership seams, not everywhere by habit. 29 min.
- Storage, Workers, and Release — Persist data, run bounded background work, and ship a small service binary with repeatable checks. 46 min.
- Observability and Operational Errors — Make service failures visible with structured logs, typed operational errors, request IDs, and safe response mapping. 44 min.
- Deploys, Health, and Incident Runbooks — Ship Go services with health endpoints, graceful shutdown, smoke checks, and incident notes a teammate can follow. 49 min.
Canonical course URL