Commit 8defd9f7 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

cmd/vet/all: exit with non-zero error code on failure

Change-Id: I68e60b155c583fa47aa5ca13d591851009a4e571
Reviewed-on: https://go-review.googlesource.com/37571Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
parent bd8a39b6
...@@ -24,6 +24,7 @@ import ( ...@@ -24,6 +24,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"sync" "sync"
"sync/atomic"
) )
var ( var (
...@@ -33,6 +34,7 @@ var ( ...@@ -33,6 +34,7 @@ var (
) )
var cmdGoPath string var cmdGoPath string
var failed uint32 // updated atomically
func main() { func main() {
log.SetPrefix("vet/all: ") log.SetPrefix("vet/all: ")
...@@ -61,6 +63,9 @@ func main() { ...@@ -61,6 +63,9 @@ func main() {
default: default:
hostPlatform.vet(runtime.GOMAXPROCS(-1)) hostPlatform.vet(runtime.GOMAXPROCS(-1))
} }
if atomic.LoadUint32(&failed) != 0 {
os.Exit(1)
}
} }
var hostPlatform = platform{os: build.Default.GOOS, arch: build.Default.GOARCH} var hostPlatform = platform{os: build.Default.GOOS, arch: build.Default.GOARCH}
...@@ -297,6 +302,7 @@ NextLine: ...@@ -297,6 +302,7 @@ NextLine:
} else { } else {
fmt.Fprintf(&buf, "%s:%s: %s\n", file, lineno, msg) fmt.Fprintf(&buf, "%s:%s: %s\n", file, lineno, msg)
} }
atomic.StoreUint32(&failed, 1)
continue continue
} }
w[key]-- w[key]--
...@@ -321,6 +327,7 @@ NextLine: ...@@ -321,6 +327,7 @@ NextLine:
for i := 0; i < v; i++ { for i := 0; i < v; i++ {
fmt.Fprintln(&buf, k) fmt.Fprintln(&buf, k)
} }
atomic.StoreUint32(&failed, 1)
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment