# Go Coverage "no statements" - Fix Empty Coverage Results in CI

> Fix Go coverage anomalies in CI - "no packages being tested depend on matches" or "coverage: [no statements]" when -coverpkg or filters cover nothing.

Source: https://latchkey.dev/learn/go/go-test-output-no-statements  
Updated: 2026-06-25

A coverage run produced an empty or misleading result. A `-coverpkg` pattern that matches no tested package, or a package with no executable statements, makes Go warn and report `0.0%` or `[no statements]` - which can silently pass a coverage gate.

## Diagnose it: environment first

```Terminal
go version
go env GOOS GOARCH CGO_ENABLED GOFLAGS GOPRIVATE GOPROXY
go mod verify
```

> `CGO_ENABLED` commonly differs between your machine and a slim CI image, and it changes whether packages importing C build at all.

## FAQ

### What causes Go coverage "no statements"?

There are 2 common causes: a -coverpkg pattern that matches nothing tested and a package with no executable statements. The packages named by -coverpkg are not imported by any package under test, so Go has nothing to instrument and warns.

### How do I fix Go coverage "no statements"?

There are 2 fixes depending on which cause you have: align -coverpkg with the tested packages and treat the warning as a gate signal. Work through them in order, since the first is the most common.

### What does Go coverage "no statements" actually mean?

A go test -cover run prints warning: no packages being tested depend on matches for pattern ..., or a package reports coverage: [no statements] / 0.0% of statements.

### How do I stop Go coverage "no statements" happening again?

Keep -coverpkg patterns in sync with what your tests import. The prevention section lists 3 changes that keep it from recurring.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
