]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/go: enable vet directive analyzer during 'go test'
authorRuss Cox <rsc@golang.org>
Mon, 30 Jan 2023 19:23:48 +0000 (14:23 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 23 Feb 2023 10:55:24 +0000 (10:55 +0000)
For #56986, run the new directive analyzer during 'go test',
to diagnose problems that would otherwise be missed,
like //go:debug appearing in the wrong place in a file
or in the wrong files.

Change-Id: I1ac230c3c67e58b5e584128e0ec6ff482cb225f9
Reviewed-on: https://go-review.googlesource.com/c/go/+/464135
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/cmd/go/alldocs.go
src/cmd/go/internal/test/test.go

index 084a10460072ab6365d5ad9e16a3a12ac3922171..6b91b53347a61a9ca034437e76b18c90984e5042 100644 (file)
 // and its test source files to identify significant problems. If go vet
 // finds any problems, go test reports those and does not run the test
 // binary. Only a high-confidence subset of the default go vet checks are
-// used. That subset is: 'atomic', 'bool', 'buildtags', 'errorsas',
-// 'ifaceassert', 'nilfunc', 'printf', and 'stringintconv'. You can see
+// used. That subset is: atomic, bool, buildtags, directive, errorsas,
+// ifaceassert, nilfunc, printf, and stringintconv. You can see
 // the documentation for these and other vet tests via "go doc cmd/vet".
 // To disable the running of go vet, use the -vet=off flag. To run all
 // checks, use the -vet=all flag.
index aaeb70a544de11f2d38582bca6d31f7c0504b3c6..904144f2799ac2fc69d93d9e1d8970206c8a1b97 100644 (file)
@@ -76,8 +76,8 @@ As part of building a test binary, go test runs go vet on the package
 and its test source files to identify significant problems. If go vet
 finds any problems, go test reports those and does not run the test
 binary. Only a high-confidence subset of the default go vet checks are
-used. That subset is: 'atomic', 'bool', 'buildtags', 'errorsas',
-'ifaceassert', 'nilfunc', 'printf', and 'stringintconv'. You can see
+used. That subset is: atomic, bool, buildtags, directive, errorsas,
+ifaceassert, nilfunc, printf, and stringintconv. You can see
 the documentation for these and other vet tests via "go doc cmd/vet".
 To disable the running of go vet, use the -vet=off flag. To run all
 checks, use the -vet=all flag.
@@ -642,6 +642,7 @@ var defaultVetFlags = []string{
        // "-cgocall",
        // "-composites",
        // "-copylocks",
+       "-directive",
        "-errorsas",
        // "-httpresponse",
        "-ifaceassert",