CLI tool that runs go test and prints uncovered blocks.
$ coverage
💪 coverage 100%, good job!
| Flag | Default | Description |
|---|---|---|
-f, --format |
lines |
Output format: lines, codeframe, json-lines |
-r, --report [file] |
coverage.lcov |
Write lcov report (for coveralls, codecov, genhtml) |
# Show uncovered blocks
coverage
# Show with source context
coverage -f codeframe
# Machine-readable JSON output
coverage -f json-lines
# Write lcov report (default: coverage.lcov)
coverage -r
# Write lcov report to a custom path
coverage -r lcov.info
# Check coverage and produce lcov report in one pass
coverage -r coverage.lcov -f codeframeSet COLOR=0 to disable ANSI colours (useful in CI or when piping output).
COLOR=0 coveragePlace a .coverage.toml in your project root to exclude files from coverage checks and the lcov report:
[exclude]
files = ["**/testdata", "**/mock"]Excluded files are omitted from both the terminal output and the lcov report.
-r lets you check coverage and produce a report in a single go test run — no need to run tests twice:
# GitHub Actions example
- run: coverage -r coverage.lcov
- uses: coverallsapp/github-action@v2
with:
file: coverage.lcovThe simplest possible way is with palabra:
palabra i coverageOr just grab binaries from releases
task test