Code

Go

Goroutines, channels, interfaces, fast single-binary CLI/network tools, and cloud/security tooling.

Chapter 1: Why Go Wins for Infrastructure & Security Tooling

Static single binaries, one-command cross-compilation, fast compiler feedback, stripped release artifacts, embedded assets, and crisp Unix CLI ergonomics.

6 scenes · 3 min

Chapter 2: Values, Pointers, Structs, Slices & Maps Under the Hood

Pass-by-value semantics, struct memory alignment and padding, 3-word slice headers, backing-array aliasing traps, hash map internals, and escape analysis.

6 scenes · 3 min

Chapter 3: Methods, Implicit Interfaces & Composition Over Inheritance

Value vs. pointer receivers, compile-time structural interfaces, small stdlib abstractions, the typed-nil interface trap, type switches, and struct embedding.

6 scenes · 3 min

Chapter 4: Explicit Error Handling (`errors.Is`/`As`, `%w`, `defer`/`panic`/`recover`)

Treating errors as ordinary values, sentinel and custom error types, context-rich `%w` wrapping, `errors.Is`/`errors.As`, `defer` LIFO guarantees, and safe `panic`/`recover` boundaries.

6 scenes · 3 min

Chapter 5: Packages, Modules & Supply-Chain Security

Package visibility and `init()` discipline, `go.mod` and Minimal Version Selection, `go.sum` and `GOSUMDB` Merkle verification, `internal/` boundaries, vendoring, and `govulncheck`.

6 scenes · 3 min

Chapter 6: Generics, Type Constraints & Standard Library Iterators

Type parameters and call-site inference, union constraints with `~` underlying types, generic containers, `slices`/`maps`/`cmp` stdlib helpers, Go 1.23+ `iter.Seq` iterators, and restraint.

6 scenes · 3 min

Chapter 7: Goroutines & the GMP Scheduler

2 KB growable goroutine stacks vs. OS threads, the G-M-P M:N scheduler, work stealing and preemption, netpoller vs. blocking syscalls, goroutine leaks, and structured lifetimes.

6 scenes · 3 min

Chapter 8: Channels, `select`, Worker Pools & Fan-In / Fan-Out Patterns

Unbuffered rendezvous vs. buffered queues, directional channel types, the four channel axioms, `select` multiplexing and timeouts, bounded worker pools, and fan-out/fan-in pipelines.

6 scenes · 3 min

Chapter 9: `sync`, Atomics & Race Detection

Data races vs. logical race conditions, `sync.Mutex` and `sync.RWMutex`, `sync.WaitGroup` and `sync.OnceValue`, `sync/atomic` typed counters and pointers, bounded error groups, and `go test -race`.

6 scenes · 3 min

Chapter 10: `context.Context` — Cancellation, Deadlines & Request Propagation

Context as first parameter, root contexts and tree cancellation, `WithTimeout`/`WithDeadline` and `defer cancel()`, error causes, scoped values with unexported keys, and end-to-end propagation across HTTP and subprocesses.

6 scenes · 3 min

Chapter 11: `io.Reader`/`io.Writer`, Streaming Buffers, JSON & Binary Encoding

Composable streaming with `io.Reader`/`io.Writer`, OOM defense with `io.LimitReader`, `bufio` scanners and flushing, strict JSON decoding, NDJSON streams, and `encoding/binary` wire frames.

6 scenes · 3 min

Chapter 12: Production `net/http` Servers, Clients, Middleware & TLS Hardening

Go 1.22+ `http.ServeMux` method/path routing, composable middleware, hardened `http.Server` timeouts, pooled `http.Client` body draining, graceful `SIGINT` shutdown, and TLS 1.3 hardening.

6 scenes · 4 min

Chapter 13: Testing, Table-Driven Tests, Fuzzing, Benchmarks & `pprof` Profiling

Idiomatic table-driven tests and `t.Parallel()`, zero-flakiness `httptest` and `t.TempDir()`, native coverage-guided fuzzing, allocation benchmarks, `pprof` CPU/heap profiles, and `sync.Pool`.

6 scenes · 3 min

Chapter 14: Building & Cross-Compiling a Fast Concurrent Network Scanner / Health CLI

End-to-end architecture combining `net/netip` CIDR parsing, context-aware TCP dialing and banner grabs, bounded workers with rate pacing and `SIGINT` handling, `log/slog` + JSON output, and verified multi-OS release builds.

6 scenes · 3 min