README
ΒΆ
GOAT - Go Automated Testing TUI
A Terminal User Interface (TUI) for running and viewing Go tests with an interactive sidebar and detailed output view.
Features
- π― Interactive TUI with keyboard and mouse navigation
- β Color-coded test results (green for pass, red for fail)
- π Detailed test output view
- π Clickable file links to open tests in your editor
- π¨ Beautiful terminal UI using Bubble Tea and Lip Gloss
- π Failed tests displayed first for quick debugging
- β‘ Real-time loading status while tests run
- π Filter toggle to show only failed tests
- π Success message when all tests pass
- β οΈ Clear error messages if something goes wrong
- π Status bar with test counts and keyboard hints
- π Scrollable content pane for long test output
- π Smart text wrapping for long test names and output
Installation
go build -o goat
Or install as a Go tool:
go install
Usage
Run the test viewer in any Go project directory:
goat
Or with a local build:
./goat
Command-Line Arguments
You can pass any go test arguments to goat:
# Run tests in a specific package
goat ./pkg/mypackage
# Run tests with verbose output
goat -v ./...
# Run specific tests by pattern
goat -run TestMyFunction ./...
# Run tests with coverage
goat -cover ./...
# Run tests with race detector
goat -race ./...
# Combine multiple flags
goat -v -race -cover ./pkg/...
Default behavior: If no arguments are provided, goat runs go test -json ./... (all tests recursively).
Key Bindings
- β/k - Move up in test list
- β/j - Move down in test list
- g/Home - Jump to first test
- G/End - Jump to last test
- Enter - Open test file at error line in editor
- f - Toggle filter (show only failed tests)
- Ctrl+D/PgDn - Scroll content down (for long test output)
- Ctrl+U/PgUp - Scroll content up (for long test output)
- q/Ctrl+C - Quit application
Mouse Controls
- Click - Select a test from the sidebar
- Scroll Wheel - Navigate up/down through tests
Project Structure
The codebase is organized into focused modules for easy maintenance:
main.go
Entry point of the application. Initializes and runs the Bubble Tea program.
types.go
Core data structures:
TestEvent- Individual events fromgo test -jsonoutputTestResult- Aggregated test result with status and outputtestsLoadedMsg- Message type for when tests are loaded
styles.go
UI styling definitions using Lip Gloss:
sidebarStyle- Test list sidebar stylingcontentStyle- Main content area stylingselectedItemStyle- Currently selected test stylingpassStyle- Green styling for passing testsfailStyle- Red styling for failing teststitleStyle- Section title styling
test_runner.go
Test execution and parsing:
loadTests()- Runsgo test -jsonand parses output- Extracts file paths and line numbers from test errors
- Sorts tests with failed tests first
editor.go
Editor integration:
openFile()- Opens files at specific lines in available editors- Supports: Zed, VS Code, Sublime Text, Atom, Vim, Neovim, Emacs
- Automatically detects which editor is available
ui.go
Bubble Tea TUI implementation:
model- Application stateInit()- InitializationUpdate()- Event handling (keyboard, mouse, messages)View()- Rendering the UIrenderSidebar()- Builds the test list sidebarrenderContent()- Builds the detailed test output viewcalculateVisibleRange()- Handles scrolling for long test lists
How It Works
- Application parses command-line arguments (defaults to
./...if none provided) - Shows loading status while running tests
- Runs
go test -json [your args...] - Tests are discovered based on your arguments
- Test output is parsed line-by-line as JSON events
- Test results are aggregated and sorted (failures first)
- TUI displays tests in a sidebar with status indicators
- Status bar shows pass/fail counts and keyboard hints
- Selecting a test shows detailed output in the content pane
- Pressing Enter opens the test file at the error line
- Press 'f' to toggle between all tests and failures only
- When all tests pass, a success message is displayed
- Long test output can be scrolled with Ctrl+D/Ctrl+U or PgDn/PgUp
- Long test names and output wrap intelligently to fit the screen
If an error occurs (e.g., no Go module, invalid path), a clear error message is shown.
Supported Editors
The application will attempt to open files in these editors (in order):
- Zed (
zed) - VS Code (
code) - Sublime Text (
subl) - Atom (
atom) - Vim (
vim) - Neovim (
nvim) - Emacs (
emacs)
Requirements
- Go 1.25.6 or later
- A terminal that supports ANSI colors
- (Optional) One of the supported editors for the "open file" feature
Dependencies
- Bubble Tea - TUI framework
- Lip Gloss - Terminal styling
License
MIT
Documentation
ΒΆ
There is no documentation for this package.