A collection of coding katas in Go for practicing Test-Driven Development (TDD), refactoring, and software design.
- Go 1.21 or later
- A code editor (VS Code recommended with Go extension)
Option 1: Official Installer (Recommended)
- Download from go.dev/dl
- Run the
.pkginstaller - Restart your terminal
Option 2: Homebrew
brew install goOption 1: Official Installer (Recommended)
- Download the
.msifrom go.dev/dl - Run the installer
- Restart your terminal/PowerShell
Option 2: Chocolatey
choco install golangOption 3: Scoop
scoop install goOption 1: Official Tarball (Recommended)
# Download latest (replace version as needed)
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
# Remove old installation and extract
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
# Add to PATH (add to ~/.bashrc or ~/.zshrc)
export PATH=$PATH:/usr/local/go/binOption 2: Package Manager
# Ubuntu/Debian (may not be latest version)
sudo apt install golang-go
# Fedora
sudo dnf install golanggo version
# Should output: go version go1.2x.x ...
⚠️ Note: The golangci-lint team recommends using binary installation or package managers overgo installfor consistent behavior.
macOS
brew install golangci-lintWindows
# Chocolatey
choco install golangci-lint
# Scoop
scoop install golangci-lintLinux / macOS / Windows (Binary Install - Recommended for CI)
# Install latest version to $(go env GOPATH)/bin
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
# Or install specific version
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2Docker (Alternative)
docker run --rm -v $(pwd):/app -w /app golangci/golangci-lint golangci-lint run# Install mutation testing tool
go install github.com/zimmski/go-mutesting/cmd/go-mutesting@latest
# Install watch mode tool (macOS/Linux)
brew install entr # or: apt install entr# 1. Verify Go is installed
go version
# 3. Clone and enter the project
cd go-kata
# 4. Download dependencies
go mod download
# 5. Run all tests to verify setup
make test
# Or without make:
go test ./...
# 6. You're ready! Start with FizzBuzz
make fizzRun make help to see all available commands:
make help # Show all commands
make test # Run all tests
make watch # Watch mode (requires: brew install entr)
make coverage # Run tests with coverage
make coverage-html # Generate HTML coverage report
make lint # Run linter (requires: brew install golangci-lint)
make fmt # Format code
make ci # Run all CI checks
make install-tools # Install dev toolsmake fizz # FizzBuzz
make leap # Leap Year
make stats # Stats Calculator
make anagrams # Anagrams
make fib # Fibonacci
make stack # Stack
make roman # Roman Numerals
make prime # Prime Factors
make tic # Tic Tac Toe
make yahtzee # Yahtzee
make mars # Mars Rover
make tennis # Tennis Refactoring
make rose # Gilded Rose
make golf # All Refactoring Golf
make smelly # Smelly Tic Tac Toe
make copier # Character Copier
make tac # Tic Tac Toe (output)
make esa # ESA Mars Rover
make cart # Shopping Cart
make social # Social Network
make smellymars # Smelly Mars Rover
make smellycart # Smelly Shopping Cart
make smellyyahtzee # Smelly Yahtzeemake golf1 # Hole 1
make golf2 # Hole 2
# ... through golf13make watch-fizz # Watch FizzBuzz
make watch-rose # Watch Gilded RoseIf you prefer not to use make, here are the raw Go commands:
# Run all tests
go test ./...
# Run specific kata
go test -v ./01_fizzbuzz/...
# Run with coverage
go test -cover ./...
# Format code
go fmt ./...
# Check for issues
go vet ./...| # | Kata | Description | Difficulty |
|---|---|---|---|
| 01 | FizzBuzz | Classic TDD starter | Beginner |
| 02 | LeapYear | Date validation logic | Beginner |
| 03 | StatsCalculator | Statistical calculations on a sequence | Beginner |
| 04 | Anagrams | Anagram generation | Beginner |
| 05 | Fibonacci | Sequence generation | Beginner |
| 06 | Stack | Data structure implementation | Beginner |
| 07 | RomanNumerals | Number conversion | Intermediate |
| 08 | PrimeFactors | Mathematical decomposition | Intermediate |
| 09 | TicTacToe | Game logic with OOP | Intermediate |
| 10 | Yahtzee | Scoring system | Intermediate |
| 11 | MarsRover | Command pattern & state | Advanced |
| 12 | Tennis | Refactoring kata | Advanced |
| 13 | GildedRose | Legacy code & testing | Advanced |
| 14 | RefactoringGolf | Progressive refactoring holes | Advanced |
| 15 | SmellyTicTacToe | Code smells identification | Advanced |
| 16 | CharacterCopier | Mocking & test doubles | Intermediate |
| 17 | TicTacToe (Output) | Game with output interface | Intermediate |
| 18 | ESA MarsRover | Multilingual rover with radio | Advanced |
| 19 | ShoppingCart | DDD & Hexagonal architecture | Advanced |
| 20 | SocialNetwork | Use case driven development | Advanced |
| 21 | Katacombs | Text adventure game | Advanced |
| 22 | SmellyMarsRover | Legacy code & test smells fixture | Advanced |
| 23 | SmellyShoppingCart | Hexagonal ports & adapters smells fixture | Advanced |
| 25 | SmellyYahtzee | Legacy code & test smells fixture (dice) | Advanced |
- ✅ Write production code only to pass a failing unit test
- ✅ Write only enough of a unit test to make it fail
- ✅ Write only enough production code to make the failing test pass
# Run mutation tests (requires go-mutesting, see Installing Development Tools)
go-mutesting ./...go-kata/
├── go.mod
├── go.sum
├── README.md
├── 01_fizzbuzz/
│ ├── fizzbuzz.go
│ ├── fizzbuzz_test.go
│ └── README.md
├── 02_leapyear/
│ └── ...
└── ...