« Previous
Next »
Summary
Go track summary: the small-language mindset, daily reflexes, and the path forward.
Go — track summary
EXAMPLE
# ===== Core mental model =====
# Go optimises for SIMPLICITY + READABILITY + COMPILE SPEED.
# Small spec. Strict tooling (gofmt, go vet, staticcheck).
# Errors as values; concurrency via goroutines + channels.
# Single binary; deploy anywhere.
# ===== Daily reflexes =====
# - Errors as values: if err != nil { return err }
# - Wrap errors with fmt.Errorf("...: %w", err)
# - Use errors.Is / errors.As for typed handling
# - context.Context as the first param of any I/O function
# - Small interfaces; satisfy implicitly
# - Goroutines with bounded concurrency (worker pools, semaphores)
# - Channels for communication; mutex for shared state
# - defer for cleanup
# ===== Tools you reach for =====
# - go fmt + go vet + staticcheck + golangci-lint
# - go test ./... -race -cover
# - go mod tidy + go mod why
# - dlv (delve) for debugging
# - pprof for performance profiling
# ===== Production patterns =====
# - cmd/<binary>/main.go layout
# - internal/ for private packages
# - structured logging with slog (since Go 1.21)
# - Graceful shutdown with signal handling
# - Multi-stage Docker -> distroless image
# - Cross-compile via GOOS / GOARCH for the target
# ===== Ecosystem =====
# - net/http stdlib is great; add chi or echo for ergonomics
# - sqlx or sqlc for databases
# - go-playground/validator for validation
# - viper / koanf for config
# - prometheus client + opentelemetry for observability
# - zap / zerolog if slog is too plain for you
# ===== Where Go wins =====
# - APIs + microservices
# - CLI tools (single static binary)
# - Network services / proxies / replicators
# - Replacing Python services that need speed
# - Container ecosystems (most of K8s, Docker, etcd is Go)
# ===== Where Go hurts =====
# - Heavy generic algorithms (improving with generics, still verbose)
# - GUI / desktop apps
# - Data science (Python / Julia dominate)
# - Anywhere you want functional-programming richness
# ===== What to learn next =====
# - Generics (Go 1.18+): real but lightweight
# - context propagation across libraries
# - opentelemetry tracing + metrics
# - gRPC and protobuf for inter-service contracts
# - Workspaces (go.work) for multi-module repos
# ===== Books + resources =====
# - The Go Programming Language (Donovan + Kernighan)
# - 100 Go Mistakes and How to Avoid Them (Teiva Harsanyi)
# - Effective Go + Go Code Review Comments
# - GopherCon talks on YouTube
# ===== Patterns to internalise =====
# - Always handle errors
# - Always cancel via context
# - Always close resources via defer
# - Always run with the race detector in CI
# - Small interfaces > large ones
# ===== Closing thought =====
# Go is a small language with a clear opinion: most software gets simpler when
# the language refuses to be clever. The constraint becomes the freedom — code
# from a different team reads like your own. Stay in the idiomatic groove and
# Go scales from solo CLI to fleets of microservices without changing shape.
Why it matters
Go is small, strict, and predictable. Master errors-as-values + context + goroutines + small interfaces + the tooling. Reach for it on APIs, CLIs, networking, and container-ecosystem code. The mental model survives across years and teams; the discipline pays back forever.
Tip: Tweak the snippet with Try it Yourself », then sit the quiz at the bottom of the page.
Example
« Previous
Next »
Discussion
Loading…