go-test
Run Go tests with race detection and coverage. Use when asked to run tests, check test coverage, or verify Go code functionality.
When & Why to Use This Skill
The Go Test Runner skill automates the execution of Golang test suites with integrated race detection and code coverage analysis. It streamlines the development workflow by providing instant feedback on code functionality, identifying concurrency issues, and generating detailed coverage reports to ensure high-quality software delivery and code reliability.
Use Cases
- Automated Regression Testing: Quickly run the entire test suite or specific packages after code modifications to ensure no regressions were introduced.
- Concurrency Validation: Utilize the built-in race detector to identify and fix complex data races in multi-threaded Go applications during the development phase.
- Code Coverage Analysis: Generate and inspect coverage profiles (text or HTML) to identify untested code paths and improve overall test suite effectiveness.
- Targeted Debugging: Execute specific package tests in verbose mode to capture detailed logs and output for faster troubleshooting of failing test cases.
| name | go-test |
|---|---|
| description | Run Go tests with race detection and coverage. Use when asked to run tests, check test coverage, or verify Go code functionality. |
| allowed-tools | ["shell"] |
| short-description | Run Go tests with race detection |
Go Test Runner
Reference: ~/.config/agent/domain/coding/go/tooling.md for Go command details
Instructions
Run Go tests with proper flags per AGENT.md guidelines:
Standard Test Run
go test -race -count 1 -coverprofile=cover.out ${ARGUMENTS}
Default to ./... if no package path is provided.
Verbose Mode
If user requests verbose output:
go test -v -race -count 1 -coverprofile=cover.out ${ARGUMENTS}
Coverage Report
After tests pass, offer to show coverage:
# Text summary
go tool cover -func=cover.out
# HTML report (opens in browser)
go tool cover -html=cover.out
Package-Specific Tests
For single package:
go test -race -count 1 ./path/to/package
Test Flags
-race: Enable race detector-count 1: Disable test caching-coverprofile: Generate coverage profile-v: Verbose output (when requested)
Arguments
Target package(s): ${ARGUMENTS:-./...}