go-test

mway 的头像作者 mway

通过种族检测和覆盖率运行 Go 测试。当要求运行测试、检查测试覆盖率或验证 Go 代码功能时使用。

📖 中文导读:通过种族检测和覆盖率运行 Go 测试。当要求运行测试、检查测试覆盖率或验证 Go 代码功能时使用。 以下正文为该技能的原始 SKILL.md 内容(英文),上方安装命令可直接使用。

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"] metadata: 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:-./...}