gotip

module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT

README

gotip

Go Test Interactive Picker

About

gotip is a TUI application for interactively selecting and running Go tests.

Key features:

  • Fuzzy filtering of test cases
  • Detection of subtest names defined via table-driven tests (partial support)
  • Run individual subtests or grouped subtests
  • View and re-run tests from execution history

Installation

go install github.com/lusingander/gotip/cmd/gotip@latest

Usage

Basic usage

In a directory containing a go.mod file, run:

gotip

While a test is selected, press Enter to run it using go test.

Passing additional arguments

You can pass extra flags directly to go test by appending them after --:

gotip -- -v -count=1
Running a parent test group

While a test is selected, press Backspace to move up to its parent test group.

This allows you to execute all subtests under that group.
For example, if you have TestFoo/Bar/Baz selected, pressing Backspace will select TestFoo/Bar, and running it will execute all tests under that prefix.

If subtest names could not be automatically discovered, gotip defaults to selecting the nearest available parent test.

Using test history

Press Tab to switch to History view.

In this view, you can select and run tests from your previous execution history, just like in the regular view.

The history data is stored under .local/state/gotip/history/.

Rerunning the last test

You can rerun the last executed test without showing the UI by using the --rerun option:

gotip --rerun

This will immediately execute the most recent test from your history.

Options
Usage:
  gotip [OPTIONS]

Application Options:
  -v, --view=[all|history]   Default view (default: all)
  -f, --filter=[fuzzy|exact] Default filter type (default: fuzzy)
  -r, --rerun                Rerun the last test without showing the UI
  -V, --version              Print version

Help Options:
  -h, --help                 Show this help message
Config

gotip supports both global and project-specific configuration.

  • Global config
    • Place your global config at ~/.config/gotip/gotip.toml. This applies to all projects.
  • Project config
    • Place a gotip.toml file in your current working directory. This applies only to the current project.

If both global and project configs exist, they are merged.
For overlapping keys, the project config takes precedence.

The format is as follows:

# Specifies the command used to run tests.
# If omitted, the default command is used.
# type: list of strings
command = []

[history]
# Limits the number of test executions to keep in history.
# type: integer
limit = 100
# Format used to display timestamps in the history view.
# Uses Go's time format syntax.
# type: string
date_format = "2006-01-02 15:04:05"
command

The command field allows you to customize how tests are executed.

You can use this to always pass specific flags or use an external test runner instead of the default.

For example, to use gotestsum, you can configure it like this:

command = ["gotestsum", "--format", "testname", "--", "-run", "${name}", "${package}"]

${name} and ${package} are placeholders that will be replaced at runtime with the selected test name pattern and package name, respectively.

If not specified, the following default command is used:

command = ["go", "test", "-run", "${name}", "${package}"]
Keybindings
Key Description
Ctrl-c Quit
j ↓ Select next item
k ↑ Select previous item
l → Select next page
h ← Select previous page
Enter Run the selected test
Backspace Select parent test group
/ Enter filtering mode
Enter Confirm filter (in filtering mode)
Esc Clear filtering mode
Ctrl-x Toggle filtering type
Tab Switch view

Planned features

  • Launch with initial filter based on package or test name
  • Custom keybindings

License

MIT

Directories

Path Synopsis
cmd
gotip command
internal
tip
ui

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL