Goroutines

Start goroutines with the go keyword, wait for them properly with sync.WaitGroup, and catch data races with the race detector.

Testing in Go

Write and run Go tests with nothing but the standard library: table-driven tests, error paths, coverage, and examples that double as documentation.

WaitGroups and mutexes

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.

Structs

Define your own struct types, create and change struct values, use pointers to structs, and write simple NewX constructor functions.

Arrays and slices

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.

Select

Use select to wait on several channels at once, add timeouts and non-blocking operations, and stop goroutines with a done channel.

Go packages and modules

Split a Go program into packages, control what other packages can see, and manage dependencies with go.mod, go get and go mod tidy.

Methods

Attach methods to your types, pick value or pointer receivers with a simple rule of thumb, and control how your types print with String().

Maps

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.