### Cgo {#cgo}
+### Vet
+
+The new `tests` analyzer reports common mistakes in declarations of
+tests, fuzzers, benchmarks, and examples in test packages, such as
+malformed names, wrong signatures, or examples that document
+non-existent identifiers. Some of these mistakes may cause tests not
+to run.
+
+This analyzer is among the subset of analyzers that are run by `go test`.
// 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, directive, errorsas,
-// ifaceassert, nilfunc, printf, and stringintconv. You can see
+// ifaceassert, nilfunc, printf, stringintconv, and tests. 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.
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, directive, errorsas,
-ifaceassert, nilfunc, printf, and stringintconv. You can see
+ifaceassert, nilfunc, printf, stringintconv, and tests. 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.
"-slog",
"-stringintconv",
// "-structtags",
- // "-tests",
+ "-tests",
// "-unreachable",
// "-unsafeptr",
// "-unusedresult",
# Tests that invalid examples are ignored.
# Verifies golang.org/issue/35284
-go test x_test.go
+# Disable vet, as 'tests' analyzer objects to surplus parameter.
+go test -vet=off x_test.go
-- x_test.go --
package x
func ExampleThisShouldNotHaveAParameter(thisShouldntExist int) {
fmt.Println("X")
// Output:
-}
\ No newline at end of file
+}