一键导入
using-mutate4go
Use when mutation-testing Go code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when mutation-testing Go code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen tests
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | using-mutate4go |
| description | Use when mutation-testing Go code, assessing test quality beyond coverage, or investigating surviving mutations to strengthen tests |
Mutation testing for Go. Mutates source code systematically, runs tests against each mutant, and reports which mutations survived versus were killed. Surviving mutations reveal gaps in the test suite that line coverage alone cannot detect.
Run from the root of a Go module:
go run github.com/unclebob/mutate4go/cmd/mutate4go@latest path/to/file.go
Or install it:
go install github.com/unclebob/mutate4go/cmd/mutate4go@latest
mutate4go path/to/file.go
# Mutation-test a source file.
# If the file has a footer manifest, this defaults to changed functions only.
mutate4go internal/foo/foo.go
# Scan mutation counts without running coverage or tests
mutate4go internal/foo/foo.go --scan
# Rewrite the embedded manifest without running coverage or mutations
mutate4go internal/foo/foo.go --update-manifest
# Retest only specific lines
mutate4go internal/foo/foo.go --lines 45,67,89
# Retest only functions changed since the last successful mutation run
mutate4go internal/foo/foo.go --since-last-run
# Override differential mode and run all covered mutations
mutate4go internal/foo/foo.go --mutate-all
# Reuse existing coverage data without refreshing it
mutate4go internal/foo/foo.go --reuse-coverage
# Run mutations in parallel with isolated workers
mutate4go internal/foo/foo.go --max-workers 3
The tool automatically:
-coverprofile=target/coverage/coverage.outgo test ./...--max-workers is greater than 1tested_at and function hashes after a run--reuse-coverageUse --scan when you want a fast module-size signal without paying for coverage or test execution.
Use --update-manifest when you want to accept the current file contents as the new differential baseline without paying for coverage or mutation execution.
| Category | Mutations |
|---|---|
| Arithmetic | + -> -, - -> +, * -> / |
| Comparison | > <-> >=, < <-> <= |
| Equality | == <-> != |
| Boolean | true <-> false |
| Logical | && <-> ` |
| Constant | 0 <-> 1 |
| Result | Meaning | Action |
|---|---|---|
| Killed | Test caught the mutation | Tests are strong here |
| Survived | Tests passed with mutant code | Write a test that would fail with the mutation |
| Timeout | Mutation hit the timeout | Treated as killed because behavior changed |
| Uncovered | Coverage did not reach the site | Add or fix tests before mutation work |
go test ./....mutate4go path/to/file.go --scan.mutate4go path/to/file.go --max-workers 3.mutate4go path/to/file.go --lines 45,67.