Skip to content
Latchkey

Go "go test -short" Skips Everything - Fix Short-Mode Gating in CI

go test -short sets testing.Short() true so tests can skip slow paths. Surprises come from both directions: a -short CI run skips tests you actually needed to gate on, or a suite that never checks testing.Short() runs every slow test despite the flag.

What this error means

A -short job reports many --- SKIP lines (or "no tests to run") for the integration tests you expected to run, or a -short job still runs slow tests because nothing in the code consults testing.Short(). The behavior is deterministic and depends only on the flag plus the test code.

go test output
=== RUN   TestIntegration
    main_test.go:12: skipping in short mode
--- SKIP: TestIntegration (0.00s)
# or: -short set but slow tests still run because no t.Skip guard exists

Common causes

-short skips the tests the job needed

A CI job ran with -short, so every test guarded by if testing.Short() { t.Skip() } was skipped - including ones that job was meant to exercise.

Tests ignore testing.Short()

A suite never checks testing.Short(), so -short has no effect and slow tests run regardless, defeating the intended fast path.

How to fix it

Run the full suite where you need slow tests

Drop -short (or use a separate non-short job) for stages that must run integration tests.

Terminal
go test ./...            # full suite
go test -short ./...     # fast unit-only stage

Gate slow tests on testing.Short()

Make slow/integration tests honor the flag so -short actually skips them.

Go
func TestIntegration(t *testing.T) {
	if testing.Short() {
		t.Skip("skipping integration test in short mode")
	}
	// ...
}

How to prevent it

  • Use -short only for fast unit stages; run the full suite elsewhere.
  • Guard slow tests with testing.Short() so the flag is meaningful.
  • Document which CI stage runs short vs full tests.

Frequently asked questions

What causes ""-short" skips tests"?
A CI job ran with -short, so every test guarded by if testing.Short() { t.Skip() } was skipped - including ones that job was meant to exercise.
How do I fix "-short" skips tests?
Drop -short (or use a separate non-short job) for stages that must run integration tests.

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card