cmd/go: go test
takes extra time to run even for packages that do not have any test files
#17248
Labels
go test
takes extra time to run even for packages that do not have any test files
#17248
Please answer these questions before submitting your issue. Thanks!
What version of Go are you using (
go version
)?go version go1.7.1 darwin/amd64
What operating system and processor architecture are you using (
go env
)?What did you do?
time go test $(go list ./... | grep -v vendor)
time go test $(go list -f '{{ if .TestGoFiles }}{{ .ImportPath }}{{ end }}' ./... | grep -v vendor)
What did you expect to see?
I expected they would take the same mostly the same amount of time
What did you see instead?
time go test $(go list -f '{{ if .TestGoFiles }}{{ .ImportPath }}{{ end }}' ./... | grep -v vendor)
is reliably faster. I've also tried runningtime for i in {1..10}; do <command>; done
and on average it is faster than not first excluding the packages without tests.This is the case even if
-parallel #
is set, whether or not-race
or if coverage numbers are generated. For instance, when running the tests for https://github.com/docker/swarmkit:In case
time
is excluding how longgo list
takes:I'm not sure if this is the issue, but maybe
go test
can automatically exclude packages provided to it that don't have tests first, and not even start building the test binary for those?The text was updated successfully, but these errors were encountered: