Foreword
Read little, type a lot. This book teaches you Go the way you need it as a platform engineer: for your own CLI tools, small services, Kubernetes tooling and AI applications. You know Bash, a bit of Python and Kubernetes; so far you have mostly read Go. Starting today, you write it.
Every day you build a small, useful tool – from a
wc clone and a kubeconfig guard to an MCP server. By the
end of the day it runs, has tests and passes go vet and the
linter.
The training rules
- Type, don’t copy. Write every line of Go yourself once. Your fingers learn too.
- Compare with Expected. After each drill you see what you should get. If yours differs, that is where the real lesson is.
- The compiler is your coach. Read error messages, don’t click them away. Go errors are short and usually exactly right.
- Pass the checkpoint. Move on only when the check script shows nothing but ✔.
- Solve the challenge on your own. Hint first, then the solution.
- Lab values stay in the lab. Keys like
sk-lab-master-1234are play money. Real tokens come only from environment variables, never into the code.
Structure of each training day
| Section | Purpose |
|---|---|
| Briefing | The essentials in a few bullet points |
| Drills | Code and commands with expected output, step by step to the tool |
| Checkpoint | Check script: does the tool run, are tests, vet and lint green? |
| Challenge | An extension without instructions, with a solution |
| Enterprise Note | What is different in production and at customer sites |
The training plan
| Part | Day | Unit | Tool of the day |
|---|---|---|---|
| Foundation | 0 | Training ground: toolchain, editor, linter | hallo with a version via -ldflags |
| 1 | Syntax in brief: variables, slices, maps, runes, bufio | wc |
|
| 2 | Structs, methods, interfaces, packages | logsum – analyze a log file |
|
| 3 | Error handling, modules, dependencies | envcheck – check tools, env, ports |
|
| 4 | Testing: tables, golden files, fuzzing, benchmarks | semver – compare versions |
|
| Toolmaking | 5 | CLIs with flag and cobra, config, os/exec | kctxsafe – context switches with a guard |
| 6 | Files, io, JSON and YAML | manifestlint – check K8s YAMLs |
|
| 7 | HTTP client, context, timeouts, retries | ghrel – query GitHub releases |
|
| 8 | Concurrency: goroutines, channels, errgroup | urlcheck – parallel URL checks |
|
| 9 | HTTP server, middleware, slog, metrics | shorturl – URL shortener |
|
| Cloud and AI | 10 | database/sql with SQLite, migrations | shorturl with persistence |
| 11 | Kubernetes with client-go, fake clientset | podwatch – report CrashLoops |
|
| 12 | Go for AI: chat, streaming, tools, embeddings, MCP | ask, docsearch, ops-mcp |
|
| Pro | 13 | Generics, iterators, pprof | logsum 10× faster |
| 14 | Releases: cross-compile, GoReleaser, distroless, CI | urlcheck as a release |
|
| 15 | Competition: timed tool challenges | several mini tools | |
| Appendix | A | Cheat Sheet | – |
| B | Final Exam | – |
The training ground
~/go-lab/
├── bin/lint golangci-lint at a pinned version (Day 0)
├── tag00-hallo/ one module per day: example.com/<tool>
│ ├── go.mod
│ ├── cmd/hallo/main.go the program (package main)
│ └── internal/... packages only this module may use
├── tag01-wc/
└── ... up to Day 15
Mac (Apple Silicon) · Go 1.26 · VS Code/GoLand with gopls · Ollama from Day 12
Every day is its own Go module with the layout
cmd/<tool>/main.go plus internal/…. All
you need is Go, Git and an editor; Docker and a real cluster are not
required. The finished state of every day is in the code/
folder of the book repo for comparison.
Tip: Tested with Go 1.26.9 on macOS (Apple Silicon) and golangci-lint 2.14.0. If a command behaves differently:
go help <befehl>,go doc <paket>and the docs at go.dev.
The companion code
All files from this book are publicly available on GitHub: https://github.com/thomaszachmann/go-zum-anfassen. Day 0 shows you how to get them.
Let’s go.
Thomas Zachmann, October 2026