Go
Notes on the Go programming language — interfaces, concurrency, testing, and patterns that have held up in production.
Simplify Go error handling by consolidating validation and system errors. Learn when to return boolean vs error for clearer failure modes.
Test Go subprocesses with the re-exec pattern: spawn your test binary as a subprocess to emulate real command behavior reliably.
Apply SOLID's Interface Segregation Principle in Go with consumer-defined contracts. Learn why small interfaces and implicit implementation matter.
Master Go context keys with custom types, avoid collisions using empty structs, and learn accessor patterns for safe request-scoped values.
Organize Go tests with in-package, external _test packages, and integration tests. Learn white-box vs black-box testing conventions.
Organize Go subtests with t.Run nesting and parallel execution. Learn patterns for setup, teardown, and readable test hierarchies.
Organize Go apps by domain, not technology. Learn why models/controllers structure hurts and how bounded contexts create better separation.
Avoid brittle AI-generated tests that check implementation details. Write maintainable tests that verify behavior, not method calls.
Prevent goroutine leaks caused by early returns with unbuffered channels. Learn buffering, draining, errgroup patterns, and goleak testing.
Master Go test lifecycle with t.Cleanup(), subtests, and TestMain. Learn per-test, grouped, and package-wide setup patterns effectively.
Separate business logic from external service calls using the Gateway pattern. Apply dependency inversion and interface segregation in Go.
Control Go test behavior with custom flags instead of build tags or env vars. Enable integration and snapshot tests with discoverable CLI options.
Dependency injection in Go doesn't need Dig or Wire. Learn why manual wiring beats reflection magic and how Go's design makes DI frameworks overkill.
Prevent dangerous struct copies with noCopy sentinel and go vet's copylock checker. Protect mutexes and sync primitives from value copies.
Pin tool versions in Go 1.24 with the new 'tool' directive. Replace tools.go pattern with native go.mod support for project tooling.