Goroutines
Start goroutines with the go keyword, wait for them properly with sync.WaitGroup, and catch data races with the race detector.
Welcome to the Go Tutorial. If you’re new here, you better start at the beginning.
Start goroutines with the go keyword, wait for them properly with sync.WaitGroup, and catch data races with the race detector.
Write and run Go tests with nothing but the standard library: table-driven tests, error paths, coverage, and examples that double as documentation.
Wait for goroutines with sync.WaitGroup, protect shared data with a mutex, run setup once, and know when to choose a mutex over a channel.
Define your own struct types, create and change struct values, use pointers to structs, and write simple NewX constructor functions.
What’s really inside a Go string, why len(“héllo”) is 6, and the strings, strconv and fmt functions you’ll use every day.
Create and grow slices with append, cut them with s[a:b], avoid the shared backing array surprise, and sort and search with the slices package.
Use select to wait on several channels at once, add timeouts and non-blocking operations, and stop goroutines with a done channel.
Split a Go program into packages, control what other packages can see, and manage dependencies with go.mod, go get and go mod tidy.
Attach methods to your types, pick value or pointer receivers with a simple rule of thumb, and control how your types print with String().
Store values by key, check whether a key exists with comma-ok, loop over a map in sorted order, and build a small word counter.