0% completed
Course Introduction
On This Page
Who This Course Is For
How the Chapters Build
The Running Example
Running the Code
The Go Version
Go that compiles and passes its tests is not always Go that keeps working in production. The difference usually comes from behavior that a small test never exercises: how memory is shared, what a value costs in memory and time, and how the program behaves when a call fails.
Consider a service that receives a large order document as a 1 MB string and stores only the 5-character product code (SKU) from it, using doc[:5]. Every test passes, because the SKU is correct. In production, memory use grows steadily, because a Go substring shares the memory of the original string. Each stored SKU therefore keeps the full 1 MB document in memory.
This course explains that kind of behavior in the language, the tools, and the standard library. You will learn to predict what your code will do under real load and to confirm the prediction with a measurement.
Who This Course Is For
The course is written for software engineers who already know Go at the level of Grokking Go. You should be comfortable with variables, slices, maps, strings and runes, structs, methods, interfaces, pointers, errors, and packages. You should also know how to start a simple goroutine.
"Advanced" describes the depth of the material, not the difficulty of the language used to explain it. Every new term is described in plain words where it first appears.
Concurrency has its own course, Grokking Concurrency in Go, and it is not repeated here. Goroutines and channels appear in this course only where a topic cannot be shown without them.
How the Chapters Build
The first chapters explain the language in more depth. The middle chapters cover how to organize, test, and measure a program. The final chapters cover the standard library and tools that production services depend on, and then combine everything into one program.
| Chapter | What it covers |
|---|---|
| 1. Values, Memory, and Semantics | Copies and sharing, the stack and the heap, and how slices, maps, strings, and structs are laid out |
| 2. Interfaces in Depth | How interface values work, the nil interface trap, embedding, and interface design |
| 3. Generics | Type parameters, constraints, inference, generic types and methods, and when to avoid them |
| 4. Iterators | Range over functions, the iter package, pull iterators, and adapters |
| 5. Error Design | Wrapping, errors.Is and errors.As, joined errors, typed errors, and panics at boundaries |
| 6. Modules and Project Structure | go.mod, version selection, workspaces, package layout, and major versions |
| 7. Testing in Depth | Table tests, helpers, fakes, fuzzing, HTTP handler tests, and coverage |
| 8. Benchmarking and Profiling | Benchmarks, benchstat, CPU and memory profiles, and profile-guided optimization |
| 9. Performance and the Runtime | Reducing allocations, the garbage collector, GOGC, GOMEMLIMIT, and cleanups |
| 10. Reflection, unsafe, and cgo | Reading types at run time, struct tags, unsafe, and calling C code |
| 11. Standard Library Power Tools | JSON, slog, os.Root, composing readers and writers, embedded files, and time |
| 12. Building HTTP Services | Routing, middleware, timeouts, validation, restarts, health checks, and metrics |
| 13. Code Generation and Tooling | go generate, parsing Go code, analyzers, build tags, and version stamping |
| 14. Capstone: An Order Service | One complete service that uses the earlier chapters, from the order types to the release build |
Every chapter ends with a quiz that checks the main ideas of its lessons.
The Running Example
The whole course builds toward an order service, and its types appear wherever a lesson needs data. You will therefore work with one set of order types throughout, rather than a new set of invented types on every page. Money is always a count of cents stored in an int64, never a floating-point number, because binary floating-point numbers cannot represent most decimal fractions exactly.
Output:
order 1001 total in cents: 3299
Running the Code
Most Go code blocks are complete programs. Each one has a Run button in the course player, and you can change the code before you run it. The player runs Linux on amd64, and below each program the lesson shows what it prints.
When the output depends on the machine or the run, the program carries the comment // Output varies between runs. and the lesson shows one possible output. Timings and memory figures are measured on one machine, so your numbers will differ. Some programs fail on purpose, and the lesson shows the error text that Go prints.
Shorter code blocks without package main are fragments that show syntax only. Commands that the player cannot run, such as go build -gcflags=-m, appear with their captured output, and you can run them on your own machine. The same is true of examples with several files, such as tests.
The Go Version
The course targets Go 1.27. When a feature or a behavior is recent, the lesson names the Go version that added it. The runtime is the support code that Go links into every program. Its internal structures can change between releases, so treat each description of them, and each measured result, as true of Go 1.27.
Reading Progress
0%
On This Page
Who This Course Is For
How the Chapters Build
The Running Example
Running the Code
The Go Version