aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/vet/main.go
diff options
context:
space:
mode:
authorDaniel Martí <mvdan@mvdan.cc>2018-06-28 17:18:01 +0100
committerDaniel Martí <mvdan@mvdan.cc>2018-06-29 08:33:11 +0000
commit1d1e25fba88b5c61cd25889d005875848a993ea3 (patch)
tree9b4498295bda708df58ea4d1cb5e76837f679fc3 /src/cmd/vet/main.go
parent997d7a1893ae15df1438c46487dd69903f16c57f (diff)
downloadgo-1d1e25fba88b5c61cd25889d005875848a993ea3.tar.gz
go-1d1e25fba88b5c61cd25889d005875848a993ea3.zip
cmd/vet: don't run buildtag check when in vetxonly mode
The check was running in the loop that read source files in, much before any of the other checks ran. Vetxonly makes vet exit early, but after all the source files have been read. To fix this, simply run the buildtag check along with all the other checks that get run on specific syntax tree nodes. Add a cmd/go test with go test -a, to ensure that the issue as reported is fixed. Fixes #26102. Change-Id: If6e3b9418ffa8166c0f982668b0d10872283776a Reviewed-on: https://go-review.googlesource.com/121395 Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'src/cmd/vet/main.go')
-rw-r--r--src/cmd/vet/main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go
index 959a536d25..28da9e2d74 100644
--- a/src/cmd/vet/main.go
+++ b/src/cmd/vet/main.go
@@ -489,7 +489,6 @@ func doPackage(names []string, basePkg *Package) *Package {
file: parsedFile,
dead: make(map[ast.Node]bool),
}
- checkBuildTag(file)
files = append(files, file)
}
if len(astFiles) == 0 {
@@ -541,6 +540,7 @@ func doPackage(names []string, basePkg *Package) *Package {
}
}
for _, file := range files {
+ checkBuildTag(file)
file.checkers = chk
if file.file != nil {
file.walkFile(file.name, file.file)