go.tools/cmd/vet: improve error message for build tag problems

Fixes golang/go#6979.

R=golang-dev, dave, iant
CC=golang-dev
https://golang.org/cl/37720048
This commit is contained in:
Rob Pike 2013-12-18 16:06:56 -08:00
parent 00fab17bd2
commit bae6bf6180
3 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ func checkBuildTag(name string, data []byte) {
continue continue
} }
if i >= cutoff { if i >= cutoff {
fmt.Fprintf(os.Stderr, "%s:%d: +build comment appears too late in file\n", name, i+1) fmt.Fprintf(os.Stderr, "%s:%d: +build comment must appear before package clause and be followed by a blank line\n", name, i+1)
setExit(1) setExit(1)
continue continue
} }

View File

@ -9,6 +9,6 @@
package testdata package testdata
// +build toolate // ERROR "build comment appears too late in file" // +build toolate // ERROR "build comment must appear before package clause and be followed by a blank line"
var _ = 3 var _ = 3

View File

@ -7,7 +7,7 @@
// +build !!bang // ERROR "invalid double negative in build constraint" // +build !!bang // ERROR "invalid double negative in build constraint"
// +build @#$ // ERROR "invalid non-alphanumeric build constraint" // +build @#$ // ERROR "invalid non-alphanumeric build constraint"
// +build toolate // ERROR "build comment appears too late in file" // +build toolate // ERROR "build comment must appear before package clause and be followed by a blank line"
package bad package bad
// This is package 'bad' rather than 'main' so the erroneous build // This is package 'bad' rather than 'main' so the erroneous build