列出测试,但不要运行它们

How do I list the tests available to go test without running them? I want to know what tests (including subtests) are present so I can manually pick a subset of them to run with a later command. I would expect something like go test -l or go test -n for something like this.

In go1.9 the go test command accepts a new -list flag, which takes a regular expression as an argument and prints to stdout the name of any tests, benchmarks, or examples that match it, without running them.

The test flags documentation can be found under https://tip.golang.org until the official go1.9 release.

There is no go subcommand for that, but you can do it with a little bit of find and grep (GNU version, for the -P flag) magic:

find /path/to/your/project -not -path "./vendor" -type f -name "*_test.go" -exec cat {} \; | grep -oP '^func (\w+)\(\w \*testing\.T\) {$' | grep -oP ' \w+' | grep -oP '\w+';