go test "no tests to run" with a -run filter in CI
go test reports "no tests to run" when the -run pattern matches no test function names. The job often still shows ok, so a typo in the filter can silently skip the whole suite.
What this error means
go test prints "testing: warning: no tests to run" and "ok ... [no tests to run]", and the run completes without executing the intended tests.
testing: warning: no tests to run
PASS
ok example.com/app 0.003s [no tests to run]Common causes
The -run regex does not match any test name
A typo or wrong casing in the -run pattern means no TestXxx name matches, so nothing runs.
Tests excluded by build tags
The test files are gated behind a build tag that the current invocation did not enable, so the package has no tests to run.
How to fix it
Correct the -run pattern
- Check the exact test function names against the
-runregex. - Use a pattern that matches, or drop
-runto run all tests. - Re-run and confirm tests execute.
# run all, or match the real name
go test ./...
go test -run '^TestFetch$' ./...Enable the build tag the tests need
If the tests are tag-gated, pass the matching -tags so they compile and run.
go test -tags=integration ./...How to prevent it
- Treat "[no tests to run]" as a signal that a filter is wrong.
- Run the full suite by default; reserve
-runfor local focus. - Pass the right
-tagsfor tag-gated test files.