Skip to Content
Skip to content
Tutorials

Programming Tutorials

Standalone programming tutorials for solving one specific problem at a time. Each guide starts with the exact error message, failing behavior, or design constraint, gives you a minimal reproducible script or query, and walks through the fix with real output.

Pick a language below or filter by topic and difficulty when you need a quick, practical reference you can test locally and apply right away.

Go
Run a Go Binary in FROM scratch With CA Certificates and Non-Root User Level: Advanced

Package a static Go binary in a FROM scratch Docker image with CA certificates for outbound HTTPS calls and a non-root numeric UID so the container runs safely in production.

Go
Understand Go Pointers (& and *) Without Guessing Level: Beginner

Learn how &x and *p work in Go, why value parameters copy data, and how to guard against nil pointer dereferences. After this, pointer bugs stop being guesswork.

Go
Organize Go Modules With go mod tidy and internal/ Packages Level: Beginner

Structure a multi-package Go repository with cmd/, internal/, go get, and go mod tidy. After this, private packages cannot be imported from outside your module.

Go
Parse Flags, Env Vars, and Exit Codes in a Go CLI Level: Beginner

Build testable Go CLIs using flag.NewFlagSet, os.Getenv defaults, os.Stderr error messages, and clean integer exit codes.

Go
Write Generic Functions in Go With comparable, cmp, slices, and maps Level: Intermediate

Use type parameters with comparable and cmp.Ordered alongside Go's standard slices and maps packages. After this, you eliminate duplicate helpers without losing type safety.

Go
Run Safe SQL Transactions in Go With BeginTx and defer tx.Rollback Level: Intermediate

Wrap multi-step SQL writes in db.BeginTx with defer tx.Rollback() and bound database connections with SetMaxOpenConns.

Go
Stop time.After Memory Leaks in Go Loops Using NewTimer and NewTicker Level: Intermediate

Avoid accumulating uncollected timers in busy select loops by using time.NewTicker and stopped time.NewTimer instances. After this, polling loops keep memory flat under load.

Go
Write Clean Go Tests With Interface Fakes, t.TempDir, and testdata Level: Intermediate

Replace external dependencies with small consumer-side interface fakes, use t.TempDir() for scratch files, and load fixtures from testdata/.

Go
Find Edge-Case Panics in Go With go test -fuzz Level: Advanced

Write FuzzX(f *testing.F) targets and run go test -fuzz to discover edge-case panics and automatically save regression cases under testdata/fuzz.

Go
Read Go Escape Analysis (-gcflags=-m) and Tune GOMEMLIMIT Level: Advanced

Inspect heap escapes with go build -gcflags=-m and set GOGC and GOMEMLIMIT to prevent container OOM kills. After this, memory usage and GC behavior are predictable in production.

Go
Diagnose Scheduler and Lock Contention With go tool trace and Mutex Profiles Level: Advanced

Capture -mutexprofile and -trace outputs from Go benchmarks to pinpoint lock contention and scheduler stalls. After this, you spot hidden blocking waits that CPU profiles miss.

Go
Read Struct Tags With reflect in Go (and Know When to Use Codegen) Level: Advanced

Inspect struct fields and tags at runtime with reflect.TypeOf, and decide when generics or go generate are a better fit.