Step 1 • Setup
Go Toolchain and Project Setup beginner Install Go via the official installer or mise/asdf for version management. Understand the Go workspace — GOPATH (legacy), Go modules (go.mod + go.sum), and the module cache. Learn the essential CLI commands — go run, go build, go test, go get, go mod tidy, go fmt, go vet, go doc. Configure your editor (VS Code with the Go extension or GoLand). Understand how go install puts binaries in $GOPATH/bin. Enable goimports for auto-formatting and import management.
Backend Go 3h Step 2 • Foundations
Syntax, Variables, and Basic Types beginner Go is explicit and minimal. Learn variable declarations (var, short := syntax, constants with const and iota), basic types (int, int64, float64, bool, string, byte, rune), zero values (0, false, "" — Go has no null), type conversions (explicit, no implicit coercion), and package-level vs function-level scope. Understand the package system (package main for executables, named packages for libraries), and how exported names start with a capital letter.
Language Go 6h Step 3 • Foundations
Control Flow — if, for, switch, defer beginner Go has no while — use for as a while loop. Learn: for init; condition; post (classic), for condition (while), for range (iterate slices/maps/channels/strings), if with an initialization statement (if err := ...; err != nil {}), switch without break fallthrough, and type switches. defer is Go's unique cleanup mechanism — schedules a function call to run when the surrounding function returns, in LIFO order. Use defer for file.Close(), mutex.Unlock(), span.End().
Language Go 5h Step 4 • Foundations
Functions, Multiple Returns, and Closures beginner Go functions are first-class. Learn function signatures, multiple return values (the (result, error) pattern is idiomatic), named return values, variadic functions (func sum(nums ...int)), and anonymous functions. Closures capture variables from the enclosing scope — understand the loop variable capture gotcha (common bug before Go 1.22). Functions are values — assign to variables, pass to other functions, return from functions. Learn the function type syntax (func(int, int) int).
Language Go 5h Step 5 • Foundations
Arrays, Slices, and Maps beginner Arrays in Go are fixed-size value types (rarely used directly). Slices are the real workhorse — a descriptor (pointer, length, capacity) over an underlying array. Understand make([]T, len, cap), append, copy, slice expressions (s[lo:hi]), and why slices share underlying arrays (mutation gotchas). Maps are hash maps — make(map[K]V), comma-ok idiom for existence check, and why map iteration order is randomized. Use slices.Sort and maps.Keys from the standard library (Go 1.21+).
Language Go 6h Step 6 • Types
Structs, Methods, and Embedding intermediate Structs are Go's main data type — named fields with types, struct literals, and field tags (json:"name"). Define methods with a receiver: func (r Receiver) Method() — value receiver vs pointer receiver (use pointer when mutating or the struct is large). Embedding (not inheritance) promotes the embedded type's methods to the outer struct. Understand anonymous structs for one-off data shapes. Use struct tags for encoding/json, validation, and database mapping.
Language Go 6h Step 7 • Types
Interfaces and Polymorphism intermediate Go interfaces are satisfied implicitly — no "implements" keyword. A type implements an interface if it has all the interface's methods. This enables loose coupling — define small interfaces near where they're used (io.Reader, io.Writer, error). Learn the empty interface (any / interface{}), type assertions (v, ok := x.(T)), type switches, and why io.Reader and io.Writer compose into io.ReadWriter. Understand interface nil traps (an interface holding a nil pointer is not nil).
Language Go 7h Step 8 • Types
Error Handling and Wrapping intermediate Errors are values in Go — the error interface has a single method Error() string. Idiomatic pattern: call the function, check err != nil, return early. Create errors with errors.New(), fmt.Errorf() with %w for wrapping (Go 1.13+). Unwrap with errors.Is() (checks the chain) and errors.As() (extracts a target type). Define custom error types with extra context. Understand sentinel errors (io.EOF, sql.ErrNoRows) and when to use them. Avoid panic for expected errors — panic is for programmer errors.
Language Go 5h Step 9 • Concurrency
Goroutines and Channels intermediate Goroutines are lightweight, cheap to create (2KB stack, grows as needed) — launch with go func(). Channels are typed, synchronized message pipes — make(chan T), make(chan T, n) for buffered. Learn send (ch <- v) and receive (v := <-ch), closing channels, ranging over channels, and the select statement for multiplexing. Understand goroutine leaks (always have a way to stop them), channel directions (chan<- T, <-chan T), and the done-channel pattern for cancellation.
Backend Go 8h Step 10 • Concurrency
sync Package and context intermediate The sync package provides low-level concurrency primitives — sync.Mutex and sync.RWMutex for protecting shared state, sync.WaitGroup for waiting on goroutines, sync.Once for one-time initialization, and sync.Map for concurrent maps. The context package propagates deadlines, cancellations, and request-scoped values — context.Background(), context.WithTimeout(), context.WithCancel(), context.WithValue(). Always accept a context.Context as the first parameter in functions doing I/O — never store it in a struct.
Backend Go 7h Step 11 • Standard Library
Key Standard Library Packages intermediate Go's standard library is exceptional. Learn: fmt (Printf verbs, Sprintf, Errorf), strings and strconv (manipulation, parsing), os and io (files, readers, writers, pipes), bufio (buffered reading), time (formatting, durations, timers, tickers), encoding/json (Marshal/Unmarshal, streaming with Decoder/Encoder), net/url (URL parsing and building), math/rand, and log/slog (structured logging, Go 1.21+). Prefer standard library over third-party for these primitives.
Backend Go 8h Step 12 • Testing
Testing, Benchmarks, and Fuzz Tests intermediate Go testing is built in — no framework needed. Files ending in _test.go, functions starting with Test (t *testing.T), t.Errorf/t.Fatalf for failures. Table-driven tests are idiomatic (a slice of {name, input, expected} structs + t.Run for subtests). Benchmarks (func BenchmarkXxx(b *testing.B)) measure performance. Fuzz tests (func FuzzXxx(f *testing.F)) auto-generate inputs to find bugs. The -race flag detects data races. testify/assert is fine but not required.
Backend Go 7h Step 13 • Web
HTTP Servers and REST APIs with net/http intermediate Go's net/http package is production-ready without a framework. Learn http.HandleFunc, http.ListenAndServe, Request (Method, URL, Headers, Body), ResponseWriter, http.ServeMux (or the new Go 1.22 pattern-matching mux with method and path variables). Middleware is a function that wraps an http.Handler — chain them for logging, auth, and panic recovery. Read the request body safely (defer r.Body.Close()). Set appropriate response headers and status codes. Understand timeouts (ReadTimeout, WriteTimeout, IdleTimeout).
Backend Go 8h Step 14 • Web
Databases with database/sql and pgx intermediate database/sql is Go's standard DB interface — sql.Open, db.QueryContext, db.ExecContext, sql.Rows (always defer rows.Close()), sql.Tx for transactions, and prepared statements. Use pgx/v5 (not database/sql) for PostgreSQL-specific features — faster, native types. sqlc generates type-safe Go code from SQL queries — write SQL, get Go functions. For ORMs, GORM is popular but adds magic; prefer sqlc + raw SQL for control. Always use parameterized queries — never string concatenate SQL.
Backend Go 8h Step 15 • Web
Web Frameworks — Chi, Echo, and Gin intermediate When net/http isn't enough, Go has excellent routers and frameworks. chi is a lightweight router that's 100% compatible with net/http — uses context for URL params, supports middleware chaining. Echo is a fast framework with a clean API — groups, middleware, request binding, validation. Gin is the most popular — slightly faster with a full ecosystem. Choose based on your needs: chi if you want stdlib compatibility, Echo or Gin for a richer feature set. Avoid mega-frameworks — Go idioms favor composition.
Backend Go 5h Step 16 • Advanced Patterns
Generics (Type Parameters) advanced Go 1.18 added generics via type parameters (func Map[T, U any](s []T, f func(T) U) []U). Learn type parameter syntax, type constraints (interface-based — comparable, any, custom), type inference, and generic data structures (Stack[T], Set[T]). The slices, maps, and cmp packages in the standard library use generics. Understand when to use generics vs interfaces — generics shine for type-preserving operations on collections, not for polymorphism. Avoid over-genericizing.
Language Go 5h Step 17 • Advanced Patterns
Performance, Profiling, and the Memory Model advanced Profile Go programs with pprof — go test -cpuprofile, go test -memprofile, runtime/pprof for inline profiling, net/http/pprof for HTTP-exposed profiles. Analyze with go tool pprof (flame graphs, top, list). Understand the garbage collector — generational? No. Tricolor mark-and-sweep. Reduce allocations with sync.Pool, pre-allocating slices, avoiding interface boxing. Use benchmarks (b.ReportAllocs()) to measure. Understand escape analysis (go build -gcflags='-m') — stack vs heap allocation.
Backend Go 7h Step 18 • Production
Production — Observability, Docker, and Deployment advanced Ship Go services with confidence. Structured logging with log/slog (key-value pairs, levels, handlers). Metrics with OpenTelemetry (traces + metrics) exported to Prometheus/Grafana or a managed OTEL backend. Health check endpoints (/healthz/live, /healthz/ready). Graceful shutdown — listen for SIGTERM, use http.Server.Shutdown(), drain in-flight requests. Build minimal Docker images (multi-stage builds — builder stage + scratch/distroless final image). Deploy on Kubernetes, Fly.io, or Railway with a proper readiness probe.
Backend Go 8h