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:
parent
00fab17bd2
commit
bae6bf6180
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue