Project: build a command-line tool in Go
Put everything together and build wordfreq, a tested command-line tool that counts words in files or standard input, then build and install it.
Welcome to the Go Tutorial. If you’re new here, you better start at the beginning.
Put everything together and build wordfreq, a tested command-line tool that counts words in files or standard input, then build and install it.
Connect goroutines with channels: send and receive values, close and range over a channel, and build a pipeline and a worker pool.
Install Go on Windows, macOS or Linux, check that it works, and set up VS Code with the official Go extension.
Log from Go programs with the standard library: the simple log package, then structured, leveled logging with log/slog in text or JSON.
How defer guarantees cleanup in Go, the order deferred calls run in, two classic pitfalls, and where panic and recover fit.
Go has exactly one loop keyword, and it covers everything: counting, while loops, infinite loops and ranging over collections.
Declare variables with var and :=, learn Go’s basic types, zero values and conversions, and understand pointers with a simple memory diagram.
Use go run and go build, create a go.mod file, check code with go fmt and go vet, cross-compile for other systems, and install programs with go install.
What Go is, why it’s worth learning, and your first Go program explained line by line, including what a compile error looks like.