December 4, 2025

Coverage cops vs test anarchists

Show HN: Identifiy test coverage gaps in your Go projects

New Go tool hunts missing tests, but devs feud over “misplaced” tests

TLDR: A new Go tool, testvet, spots missing tests and low coverage. Devs praise the features but clash over “misplaced” tests—some want it inside a one‑stop linter, others say test files need not mirror code files; either way, it could help teams ship fewer bugs.

Today in Go-land, the community is buzzing about testvet, a new tool that plays test detective: it spots functions with no tests, flags low coverage, and even calls out “misplaced tests” that mostly poke at code in another file. Sounds helpful, right? Cue the drama. One camp is yelling “lint all the things!”, with TriangleEdge begging for a drop-in to the popular one-stop linter golangci-lint because convenience is king. Another camp, led by mxey, fires back with a purist hot take: tests don’t need to mirror source files—so stop policing file feng shui.

The feature list reads like a crime lab report: it doesn’t just look at names, it actually analyzes calls in tests (think: reading the code’s “story” rather than the labels), and it can show where coverage is weak. Devs joked about “coverage cops” and “test HOA notices” when the misplacement warnings appeared, while others cheered the clean output and the “just tell me what I missed” vibe. The vibe is classic internet: helpful tool, intense debate. Is this a productivity booster or a test-style hall monitor? Either way, folks agree that catching missing or weak tests is a win—where those tests live is where the gloves come off.

Key Points

  • testvet is a Go static analysis tool that identifies functions not called by any test and detects misplaced test files.
  • It performs AST-based analysis of test functions (Test*, Benchmark*, Example*, Fuzz*) to track actual function calls.
  • By default, it runs go test -coverprofile and excludes functions with ≥50% coverage from the missing tests list.
  • A configurable threshold (e.g., 80%) reports functions with low statement coverage; coverage filtering can be disabled.
  • Installation and usage include go install, building from source, directory selection, verbose mode, excluding private functions, and specific flags.

Hottest takes

“Can you add this to golangci-lint? One stop shop.” — TriangleEdge
“No need for a 1:1 relationship between code and tests” — mxey
Made with <3 by @siedrix and @shesho from CDMX. Powered by Forge&Hive.