go/analysis/passes/tests: enable fuzz checks in 'tests' analysis pass for cmd/vet
This will remove the flag analysisinternal.DiagnoseFuzzTests created during golang/go#50198.Malformed fuzz target check will be enabled for cmd/vet.
For golang/go#46218
Change-Id: I5cc8d685a57060f8dd84c1957f0d296a6205ddb6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/471295
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Nooras Saba <saba@golang.org>
diff --git a/gopls/doc/analyzers.md b/gopls/doc/analyzers.md
index b56f4dd..2717108 100644
--- a/gopls/doc/analyzers.md
+++ b/gopls/doc/analyzers.md
@@ -554,7 +554,7 @@
check for common mistaken usages of tests and examples
-The tests checker walks Test, Benchmark and Example functions checking
+The tests checker walks Test, Benchmark, Fuzzing and Example functions checking
malformed names, wrong signatures and examples documenting non-existent
identifiers.
diff --git a/gopls/internal/lsp/source/api_json.go b/gopls/internal/lsp/source/api_json.go
index 1399e87..7863915 100644
--- a/gopls/internal/lsp/source/api_json.go
+++ b/gopls/internal/lsp/source/api_json.go
@@ -363,7 +363,7 @@
},
{
Name: "\"tests\"",
- Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
+ Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark, Fuzzing and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
Default: "true",
},
{
@@ -1037,7 +1037,7 @@
},
{
Name: "tests",
- Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
+ Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark, Fuzzing and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
URL: "https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/tests",
Default: true,
},
diff --git a/gopls/main.go b/gopls/main.go
index 02657e9..41c7cdb 100644
--- a/gopls/main.go
+++ b/gopls/main.go
@@ -19,15 +19,10 @@
"golang.org/x/tools/gopls/internal/hooks"
"golang.org/x/tools/gopls/internal/lsp/cmd"
- "golang.org/x/tools/internal/analysisinternal"
"golang.org/x/tools/internal/tool"
)
func main() {
- // In 1.18, diagnostics for Fuzz tests must not be used by cmd/vet.
- // So the code for Fuzz tests diagnostics is guarded behind flag analysisinternal.DiagnoseFuzzTests
- // Turn on analysisinternal.DiagnoseFuzzTests for gopls
- analysisinternal.DiagnoseFuzzTests = true
ctx := context.Background()
tool.Main(ctx, cmd.New("gopls", "", nil, hooks.Options), os.Args[1:])
}