This directory contains all runnable code examples from the book "Go In Action (Second Edition)".
- chapter01 - Introducing Go: Basic goroutines, channels, interfaces, generics
- chapter02 - Diving Into Go: Word count program, scope, and fundamentals
- chapter03 - Primitive Types: Integers, floats, strings, runes, pointers, structs
- chapter04 - Collection Types: Arrays, slices, and maps
- chapter05 - Working With Types: Named types, methods, interfaces, composition
- chapter06 - Generics: Type parameters and generic data structures
- chapter07 - Errors: Error handling, custom errors, panic/recover
- chapter08 - Testing: Unit tests, table-driven tests, benchmarks
- chapter09 - Concurrency: Goroutines, channels, WaitGroups, mutexes
- chapter10 - Standard Library: JSON, XML, flags, file I/O
- chapter11 - Larger Projects: Modules, packages, workspaces
Each chapter directory contains:
- Runnable
.gofiles - A
README.mdwith specific instructions - Any supporting files needed
Navigate to any chapter and run:
cd chapter01
go run goroutine_basic.go- Go 1.18 or later (for generics support)
- Some examples may require additional packages (noted in chapter READMEs)
To run all tests in a chapter:
cd chapter08
go test -vTo build any program:
go build -o program_name file.go
./program_nameEnjoy learning Go! 🎉