]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet/all: print all unparseable lines
authorJosh Bleecher Snyder <josharian@gmail.com>
Thu, 13 Apr 2017 13:08:20 +0000 (06:08 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Thu, 13 Apr 2017 14:05:34 +0000 (14:05 +0000)
In my experience, this usually happens when vet panics.
Dumping all unparseable lines should help diagnosis.

Inspired by the trybot failures in CL 40511.

Change-Id: Ib73e8c8b2942832589c3cc5d33ef35fdafe9965a
Reviewed-on: https://go-review.googlesource.com/40508
Reviewed-by: Rob Pike <r@golang.org>
src/cmd/vet/all/main.go

index 03337a4e8bada5003ab938aaca5eb502130e5436..64b3a0157a22edec6380f21401150bd100622167 100644 (file)
@@ -217,6 +217,7 @@ func (p platform) vet() {
 
        // Process vet output.
        scan := bufio.NewScanner(stderr)
+       var parseFailed bool
 NextLine:
        for scan.Scan() {
                line := scan.Text()
@@ -235,7 +236,11 @@ NextLine:
                case 3:
                        file, lineno, msg = fields[0], fields[1], fields[2]
                default:
-                       log.Fatalf("could not parse vet output line:\n%s", line)
+                       if !parseFailed {
+                               parseFailed = true
+                               fmt.Fprintln(os.Stderr, "failed to parse vet output:")
+                       }
+                       fmt.Println(os.Stderr, line)
                }
                msg = strings.TrimSpace(msg)
 
@@ -258,6 +263,10 @@ NextLine:
                }
                w[key]--
        }
+       if parseFailed {
+               atomic.StoreUint32(&failed, 1)
+               return
+       }
        if scan.Err() != nil {
                log.Fatalf("failed to scan vet output: %v", scan.Err())
        }