We break down how, in Go, documentation examples can be turned into auto-verified tests: how
Example functions work in
*_test.go, how the runner intercepts
stdout and compares it to the expected text in the
// Output: comment, why examples do not replace
TestXxx, how to name examples to bind them to the API, and how to avoid flakiness due to nondeterministic output (
map, time, randomness).