# Compact go test output


# Compact go test output

`go test ./...` on a real module prints a result line for every package and, on
failure, the full test output - which an agent can pull into context in a single
read and spend most of its token budget on. banish compacts that output before it
reaches Claude Code, Cursor, or any MCP agent, keeping the failures and dropping
the wall of passing packages.

## The problem - go test output is repetitive

A passing run is dozens of `ok package/path` lines that all say the same thing. A
failing run buries the one `--- FAIL` the agent needs under those same passing
lines plus the surrounding noise. Reading it verbatim spends tokens on packages
that did exactly what was expected.

## Before and after with banish

banish runs the real command and pipes the output through the go filter:

| Command | Raw tokens | Compacted | Saved |
| --- | --- | --- | --- |
| go test ./... (1 fail) | 330 | 41 | 88 percent |

The filter keeps every failure verbatim and collapses the passing packages into a
count, so the agent sees what broke without paging through what did not. See the
full spread across commands on the [benchmarks](/docs/reference/benchmarks) page,
reproducible with `banish bench`.

## How the go filter works

The go filter ships with banish and compacts `go test`, `go build`, and `go vet`.
It keeps the failures and error lines and collapses the passing packages; when the
kept output is very long it caps the length and marks how many more lines were
dropped, so nothing is removed silently. If a filter fails, banish returns the raw
output rather than swallowing it. See [built-in filters](/docs/reference/built-in-filters)
for the full set.

## Write your own for another command

The same approach works for any noisy command. The [.bsh language](/docs/concepts/bsh-language)
lets you define a filter in about ten lines - no recompile. To start compacting
go test output in your own agent, [set up an agent](/docs/getting-started/set-up-an-agent).
