Skip to content
Latchkey

Go "no test files" with -tags excluded - Fix in CI

Files behind a //go:build tag are invisible to the compiler unless the tag is requested. Tests in those files silently do not run, so coverage drops and "no test files" appears for the package.

What this error means

CI reports [no test files] for a package that clearly has integration tests, or the integration suite never runs. The tests are gated behind a build tag the test command did not pass.

go
?   	example.com/app/integration	[no test files]

Common causes

Build tag not passed to go test

The integration files carry //go:build integration, but go test ran without -tags integration, so they were excluded.

Tag name mismatch

The directive tag and the -tags value differ in spelling or case, so nothing matches and the files stay excluded.

How to fix it

Pass the matching build tag

  1. Run the integration suite with the same tag the files declare.
shell
go test -tags integration ./...

Align the directive and the flag

  1. Confirm the file header tag exactly matches the -tags value.
Go
//go:build integration

package integration

How to prevent it

  • Document which tags each suite needs and pass them in CI.
  • Keep the //go:build tag name and the -tags value identical.
  • Add a CI job per tag so gated suites always run.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →