Skip to content

Commit

Permalink
cmd/dist: only test packages and commands that have tests
Browse files Browse the repository at this point in the history
Change-Id: I7aeb9fef3739c17c03fdaadbe00cd945ec9c0d72
Reviewed-on: https://go-review.googlesource.com/10492
Run-TryBot: Andrew Gerrand <[email protected]>
Reviewed-by: Brad Fitzpatrick <[email protected]>
TryBot-Result: Gobot Gobot <[email protected]>
  • Loading branch information
adg committed May 28, 2015
1 parent ccc0376 commit 4c050fe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cmd/dist/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 4c050fe

Please sign in to comment.