Go · Comparison
Go test coverage: go test -cover vs Supercov
Compare go test -cover's statement coverage with Supercov's branch, MC/DC, per-test and assertion coverage for Go, with a condition every statement misses.
go test -cover vs Supercov
Start with go test -cover. It is built into the Go toolchain, needs no
dependency, and tells you which statements ran. Supercov runs the same
go test command and adds branches, independent conditions, coverage per test
and which statements your assertions check.
| Feature | go test -cover1.27.1 | Supercov2.0.0 |
|---|---|---|
| Code quality scoring | Not built in | Supported |
| Security review | Not built in | Supported |
| Line coverage | Supported | Supported |
| Branch coverage | Not built in | Supported |
| MC/DC | Not built in | Supported |
| Per-test coverage | Not built in | Supported |
| Assertion coverage | Not built in | Supported |
| Reports | Supported | Supported |
✓ Supported · × Not built in. Standard coverage workflows in the versions shown; custom plugins are outside this table.
Supercov requires Go 1.22 or newer and runs your own `go test` command against an instrumented copy of the module.
The Go toolchain counts statements per run. A test that calls t.Parallel() shares one counter array with the tests beside it, so Supercov counts that coverage run-wide rather than naming a test for it.
Per-test coverage means individual tests, not just test files. Supercov needs a supported runner. Assertion coverage links source to checked properties through agent review; it is not a mutation score or a correctness guarantee. Security review comes from Supercov’s Jev checks; reports means a browsable HTML report from the tool itself.
go test -cover: statements, one profile per run
go test -cover ./...
go test -coverprofile=cover.out ./...
go tool cover -html=cover.out
The unit is the statement. In the default mode the question is, in the Go
documentation’s words, “does this statement
run?”; -covermode=count counts
how many times, and -race switches the default to atomic. -coverpkg
widens coverage beyond the package under test.
The profile covers the whole run. It does not say which test ran a statement,
and it has no notion of a branch outcome: both sides of an if are just the
statements inside them. The Go blog’s coverage
article explains the design.
What MC/DC adds to a Go test
func CanAccess(signedIn, expired bool) bool {
if signedIn && !expired {
return true
}
return false
}
func TestAccess(t *testing.T) {
if !CanAccess(true, false) {
t.Fatal("active session denied")
}
if CanAccess(false, false) {
t.Fatal("signed-out visitor allowed")
}
}
Every statement runs, so go test -cover reports 100%. Yet no test has a
signed-in user with an expired session, so nothing shows that expiry can deny
access on its own. Add CanAccess(true, true) to cover it. This is an
illustrative example, not a published cross-tool Go measurement.
Where Supercov fits
With Go 1.22 or newer, run your own test command through Supercov:
go run github.com/supercorp-ai/supercov/cmd/supercov@latest -- go test ./...
go run github.com/supercorp-ai/supercov/cmd/supercov@latest runs latest gaps
It instruments a copy of the module, so your source tree is unchanged, and it reports the missing condition above by name. The Go guide has the setup and a runnable example; runner support covers parallel tests and the other limits.
Keep go test -cover when a statement percentage answers your question. Use
Supercov when you, or your coding agent, need to know which conditions and
checks are missing, and which test would close the gap. Neither score proves
the program correct.