Go
roadmap.sh: https://roadmap.sh/golang
Suggested path through the Go nodes. Each node links to its lesson when written.
Nodes
Introduction
- What is Go
- Why Go (Simplicity / Concurrency)
- Installing Go
- Go Toolchain (
gocommand) - Hello World
go run/go build/go install- GOROOT / GOPATH / Go Modules
Basics / Syntax
- Variables &
:= - Constants &
iota - Basic Types
- Zero Values
- Type Conversions
- Operators
- Control Flow (
if/for/switch) defer- Comments
Functions
- Declaring Functions
- Multiple Return Values
- Named Return Values
- Variadic Functions
- Closures & Anonymous Functions
- First-Class Functions
defer,panic,recover
Data Structures
- Arrays
- Slices
- Slice Internals (len / cap)
- Maps
- Structs
- Anonymous Structs
- Struct Embedding
- Pointers
Methods & Interfaces
- Methods
- Pointer vs Value Receivers
- Interfaces
- Empty Interface /
any - Type Assertions
- Type Switches
- Interface Composition
Stringer& Common Interfaces
Generics
- Type Parameters
- Constraints
comparable&constraintsPackage- Generic Functions & Types
Error Handling
- The
errorInterface - Creating Errors (
errors.New,fmt.Errorf) - Error Wrapping (
%w) errors.Is/errors.As- Custom Error Types
- Sentinel Errors
Concurrency
- Goroutines
- Channels
- Buffered Channels
selectsync.WaitGroupsync.Mutex/RWMutexsync.OncecontextPackage- Worker Pools
- Race Detector
Packages & Modules
- Packages
- Imports
- Exported vs Unexported
- Go Modules (
go.mod/go.sum) go get& Versioning- Workspaces (
go.work) initFunctions
Standard Library
fmtstrings/strconvos/iobufiotimeencoding/jsonnet/httpsortregexplog/log/slog
Testing & Tooling
testingPackage- Table-Driven Tests
- Benchmarks
go test& Coverage- Fuzzing
go fmt/gofmtgo vetgolangci-lintpprofProfiling- Delve Debugger
Web & Beyond
- Building HTTP Servers
- Routing & Middleware
- Web Frameworks (Gin / Echo / Chi)
- Database Access (
database/sql) - ORMs (GORM / sqlc)
- gRPC & Protobuf
- Cross-Compilation
Resources
See resources.md.
Project ideas
- Harden the existing
playgrounds/go/worker-poolinto a generic, context-cancellable pool: add acontext.Contextfor graceful shutdown, error aggregation, and a benchmark plus race-detector run (go test -race). - Add a
playgrounds/go/url-shortenerHTTP service using onlynet/httpandencoding/json(in-memory map +sync.RWMutex), then layer table-driven handler tests over it. - Generalize
playgrounds/go/binary-searchinto a genericfunc BinarySearch[T cmp.Ordered](…)using type parameters, with a fuzz test (go test -fuzz) to find edge cases.