Lesson 05 · Backend & Systems with Go
Go: Capstone — Build & Ship Real Projects
The Go track's capstone: build one real module end to end - a task store shared by an HTTP JSON API and a CLI - and drive it like a professional, with table-driven tests, go vet, the race detector, benchmarks, cross-compilation and a README whose commands have actually been run.
Prerequisites: Go: HTTP Services with net/http
Learning objectives
By the end of this lesson, you will be able to:
- Structure a real Go project: one module (go mod init, go.mod, go mod tidy), cmd/ directories of thin binaries, and shared behavior in internal/ packages the compiler helps you keep private
- Drive a project with the toolchain: go run, go build ./..., go vet ./..., gofmt -l, and go doc on your own packages and the standard library
- Write table-driven tests with t.Run subtests, and test HTTP handlers with httptest.NewRequest and httptest.NewRecorder - no port, no network
- Arm the race detector with go test -race, and read a benchmark's ns/op, B/op and allocs/op from go test -bench -benchmem
- Cross-compile with GOOS and GOARCH, and ship a project as code plus tests plus a README whose commands have actually been executed