]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: only test packages and commands that have tests
authorAndrew Gerrand <adg@golang.org>
Thu, 28 May 2015 22:14:58 +0000 (15:14 -0700)
committerAndrew Gerrand <adg@golang.org>
Thu, 28 May 2015 22:43:21 +0000 (22:43 +0000)
Change-Id: I7aeb9fef3739c17c03fdaadbe00cd945ec9c0d72
Reviewed-on: https://go-review.googlesource.com/10492
Run-TryBot: Andrew Gerrand <adg@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/test.go

index f5a0dc50f1b69019ac2116a6b1e67277f2d944df..2c80aa6181a738983efc64821435b252358e6d96 100644 (file)
@@ -395,7 +395,9 @@ func (t *tester) registerTests() {
        // of running `go list std cmd` if we're running a specific test.
        // Now we know the names of all the other tests registered so far.
        if !t.wantSpecificRegisteredTest() {
-               all, err := exec.Command("go", "list", "std", "cmd").Output()
+               // Use a format string to only list packages and commands that have tests.
+               const format = "{{if (or .TestGoFiles .XTestGoFiles)}}{{.ImportPath}}{{end}}"
+               all, err := exec.Command("go", "list", "-f", format, "std", "cmd").Output()
                if err != nil {
                        log.Fatalf("Error running go list std cmd: %v", err)
                }