Commit d64c4909 authored by Fatih Arslan's avatar Fatih Arslan Committed by Rob Pike

cmd/vet: set exit status to non zero for all cases

Vet returns with a nonzero exit for all possible messages in the
buildtag check. However for this file:

    //+buildlinux

    package main

vet returns a zero exit status:

    $ go vet main.go
    demo.go:1: possible malformed +build comment
    $ echo $?
    0

This CL sets the exit status to non zero for the remaining messages in
the buildtag check.

Change-Id: Ia2c35ebc3ec5ac311d2a0295b5b9fdd997a85726
Reviewed-on: https://go-review.googlesource.com/44371Reviewed-by: default avatarRob Pike <r@golang.org>
parent b74f01d7
......@@ -52,6 +52,7 @@ func checkBuildTag(name string, data []byte) {
if !bytes.Equal(fields[0], plusBuild) {
// Comment is something like +buildasdf not +build.
fmt.Fprintf(os.Stderr, "%s:%d: possible malformed +build comment\n", name, i+1)
setExit(1)
continue
}
if i >= cutoff {
......@@ -85,6 +86,7 @@ func checkBuildTag(name string, data []byte) {
// Comment with +build but not at beginning.
if bytes.Contains(line, plusBuild) && i < cutoff {
fmt.Fprintf(os.Stderr, "%s:%d: possible malformed +build comment\n", name, i+1)
setExit(1)
continue
}
}
......
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