This repository is a practical Go workbook for self-study, team onboarding, and interview preparation. It is designed to take you from your first Go program to production-oriented topics like testing, concurrency, profiling, web APIs, database access, and project architecture.
No single workbook can literally cover every obscure corner of Go, but this one covers the language, the toolchain, the standard library patterns you will use most, and the professional workflows expected in real Go projects.
- A guided learning path in
docs/ - Hands-on exercises in
exercises/ - Runnable example programs in
examples/ - A practical engineering handbook in
DEVELOPMENT_GUIDE.md - A quick reference in
CHEATSHEET.md - A tiny starter app in
cmd/hello
docs/01-introduction-and-setup.mddocs/02-core-syntax-and-types.mddocs/03-control-flow-and-functions.mddocs/04-collections-strings-and-runes.mddocs/05-structs-methods-and-interfaces.mddocs/06-generics-errors-and-testing.mddocs/07-concurrency-and-context.mddocs/08-standard-library-io-and-cli.mddocs/09-http-apis-and-json.mddocs/10-databases-modules-and-tooling.mddocs/11-performance-and-internals.mddocs/12-architecture-patterns-and-next-steps.mddocs/13-advanced-topics-and-appendix.md
For each chapter:
- Read the chapter notes and skim the code snippets.
- Run the matching example program in
examples/. - Solve the related exercise file in
exercises/. - Write your own variation before moving on.
- Summarize the topic in your own words.
.
├── cmd/
│ └── hello/
├── docs/
├── exercises/
├── examples/
│ ├── basics/
│ ├── cli/
│ ├── collections/
│ ├── concurrency/
│ ├── errors/
│ ├── generics/
│ ├── methods/
│ ├── testing/
│ └── webapi/
├── DEVELOPMENT_GUIDE.md
├── CHEATSHEET.md
├── Makefile
└── go.mod
Install Go 1.22 or newer, then run:
go version
go run ./cmd/hello
go run ./examples/basics
go run ./examples/collections
go run ./examples/methods
go run ./examples/generics
go run ./examples/errors
go run ./examples/concurrency
go run ./examples/cli --name "Gopher" --n 2
go test ./...
go test -race ./...
go test -bench=. ./examples/testing/pkg/...You can also use the included Makefile:
make hello
make basics
make test
make race
make bench- Reading and writing idiomatic Go
- Understanding packages, modules, and project layout
- Modeling data with structs, methods, and interfaces
- Handling errors explicitly and predictably
- Writing tests, benchmarks, and fuzz tests
- Building concurrent and cancelable workflows
- Working with files, JSON, HTTP, and command-line apps
- Designing maintainable services and packages
- Profiling performance and reducing unnecessary allocations
- Chapters 1 and 2
- Run
cmd/helloandexamples/basics - Complete
exercises/01-foundations.md
- Chapters 3 and 4
- Run
examples/collections - Practice slice, map, and string problems
- Chapter 5
- Run
examples/methods - Complete
exercises/02-structs-and-interfaces.md
- Chapter 6
- Run
examples/generics,examples/errors, andgo test ./...
- Chapter 7
- Run
examples/concurrency - Complete
exercises/03-concurrency.md
- Chapters 8 and 9
- Run
examples/cliandexamples/webapi - Complete
exercises/04-web-and-data.md
- Chapters 10 and 11
- Practice modules, tooling, profiling, and SQL design
- Chapter 12
- Chapter 13
- Build a small service or CLI from scratch
- Review
DEVELOPMENT_GUIDE.md
- A CLI task tracker with file persistence
- A REST API with JSON validation and tests
- A worker-pool job processor with cancellation
- A URL shortener with an in-memory store, then a SQL store
- A metrics collector that reads files and serves HTTP endpoints
- Simplicity is a feature, not a limitation.
- Clear code beats clever code.
- Small interfaces and explicit errors scale well.
- Concurrency is powerful, but only when cancellation and ownership are clear.
- The toolchain is part of the language. Learn it early.