mirror of
https://github.com/golang/go
synced 2024-11-19 08:44:39 -07:00
cmd/vet/all: print all unparseable lines
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>
This commit is contained in:
parent
ab636b899c
commit
7fa3b79ce5
@ -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())
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user