Skip to main content

How to list the tests that will be run by a go test command

  • Tagged with golang
  • Posted

Use go test -list={pattern}.

If you want to see what tests will run if you run go test, you can pass the -list flag with a pattern. Here’s an example:

$ go test -list='TestGo*'
TestGoMod
TestGoVersion
ok  	tailscale.com	0.180s

If you want to see all the tests that will be run, use . as your pattern:

$ go test -list=.
TestGoMod
TestLicenseHeaders
TestPackageDocs
TestDockerfileVersion
TestGoVersion
ok  	tailscale.com	0.201s