]> Cypherpunks repositories - gostls13.git/commitdiff
go cmd: print more than one error when running go test
authorRobert Griesemer <gri@golang.org>
Thu, 23 Feb 2012 06:33:45 +0000 (22:33 -0800)
committerRobert Griesemer <gri@golang.org>
Thu, 23 Feb 2012 06:33:45 +0000 (22:33 -0800)
Fixes #3055.

R=rsc, r
CC=golang-dev
https://golang.org/cl/5683079

src/cmd/go/test.go

index 57cdc7696ad593ce33d1bf00071e0c0a35485ba8..26b71fec1cca9ef1f9223c50c738e9596592aff2 100644 (file)
@@ -11,6 +11,7 @@ import (
        "go/build"
        "go/doc"
        "go/parser"
+       "go/scanner"
        "go/token"
        "os"
        "os/exec"
@@ -299,6 +300,16 @@ func runTest(cmd *Command, args []string) {
        for _, p := range pkgs {
                buildTest, runTest, printTest, err := b.test(p)
                if err != nil {
+                       if list, ok := err.(scanner.ErrorList); ok {
+                               const n = 10
+                               if len(list) > n {
+                                       list = list[:n]
+                               }
+                               for _, err := range list {
+                                       errorf("%s", err)
+                               }
+                               continue
+                       }
                        errorf("%s", err)
                        continue
                }