πΉ gotcha
gotcha is a test automation tool for Go developers. It watches for file changes and automatically runs go test,
supporting TDD and fast feedback.
β¨ Features
- β
Automatically detects changes in
.go files and runs go test
- β
Define target/excluded paths and test flags in
.gotcha.yaml
- β
gotcha run for one-shot test execution
- β
gotcha watch for continuous test running on save
- β
Colored output for test success/failure
- β
Easy initialization with
gotcha init
| Tool |
Language |
Purpose |
How gotcha differs |
spring rspec |
Ruby |
Fast RSpec runs via preload |
gotcha is CLI-based and watch-driven, optimized for Go |
watchexec |
Any |
Run any command on file change |
gotcha is Go-native, built specifically for go test |
gotestsum |
Go |
Pretty test output formatting |
gotcha supports live watching and reruns with test summary |
entr |
Any |
Minimal file-change trigger |
gotcha provides YAML config, input control (r, q), and output handling |
Unlike generic file watchers, gotcha is purpose-built for Go developers who want fast, automatic test feedback
without extra setup or dependencies.
β
Lightweight CLI
β
Integrated go test runner
β
.gotcha.yaml for fine-grained test control
β
Supports --summary for clean test result overview
β
watch mode with keyboard control (r to rerun, q to quit)
π¦ Install
# go >= v1.24
go get -tool github.com/mickamy/gotcha@latest
# go < v1.24
go install github.com/mickamy/gotcha@latest
or
git clone https://github.com/mickamy/gotcha.git
cd gotcha
make install
π Usage
1. Initialize
gotcha init
This generates .gotcha.yaml:
include:
- "./..."
exclude:
- "vendor/"
- "mocks/"
args:
- "-v"
2. Run once
gotcha run
3. Watch for changes
gotcha watch
This reruns tests automatically whenever .go files change.
βοΈ Configuration (.gotcha.yaml)
| Field |
Description |
include |
Target packages (passed to go list) |
exclude |
Directories or paths to ignore |
args |
Arguments passed to go test (e.g. -v, -race) |
π‘ Why gotcha?
Compared to similar tools like gotestsum, richgo, ginkgo watch, and entr, gotcha provides:
- π§ Zero-config default behavior: just run
gotcha watch in any Go project
- π§Ή YAML-based filtering: simple includes/excludes for packages and paths
- π¦ Lightweight: single-purpose CLI with no dependencies on external runners or frameworks
- π― TDD-first design: optimized for fast, repeated test execution during development
- π Clean, colored terminal UX: highlights pass/fail status clearlyz
π£ Roadmap
-
--fast flag to test only changed packages
-
.gotcha.yaml watch-specific settings (e.g. debounce)
π License
MIT