go/analysis/cmd/vet: new name for cmd/analyze
This is the new vet command. It can be run standalone:
$ vet my/project/...
or (soon) under go vet:
$ GOVETTOOL=$(which vet) go vet my/project/...
A forthcoming CL will add support for the second mode, and define a
vet-lite command that supports only that mode, but has fewer
dependencies; it is intended to be vendored into $GOROOT/src/cmd/vet.
Change-Id: I57696ae6d43aa31fd10b370247b7e7497f0f3597
Reviewed-on: https://go-review.googlesource.com/c/143417
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
diff --git a/go/analysis/cmd/analyze/README b/go/analysis/cmd/vet/README
similarity index 100%
rename from go/analysis/cmd/analyze/README
rename to go/analysis/cmd/vet/README
diff --git a/go/analysis/cmd/analyze/analyze.go b/go/analysis/cmd/vet/vet.go
similarity index 91%
rename from go/analysis/cmd/analyze/analyze.go
rename to go/analysis/cmd/vet/vet.go
index b77bbbd..ed075c4 100644
--- a/go/analysis/cmd/analyze/analyze.go
+++ b/go/analysis/cmd/vet/vet.go
@@ -2,9 +2,9 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// The analyze command is a static checker for Go programs, similar to
-// vet, but with pluggable analyzers defined using the analysis
-// interface, and using the go/packages API to load packages in any
+// The vet command is a static checker for Go programs. It has pluggable
+// analyzers defined using the golang.org/x/tools/go/analysis API, and
+// using the golang.org/x/tools/go/packages API to load packages in any
// build system.
//
// Each analysis flag name is preceded by the analysis name: --analysis.flag.
diff --git a/go/analysis/doc.go b/go/analysis/doc.go
index 7ea7807..4223ab8 100644
--- a/go/analysis/doc.go
+++ b/go/analysis/doc.go
@@ -72,15 +72,15 @@
A driver may use the name, flags, and documentation to provide on-line
help that describes the analyses its performs.
-The "analyze" command, shown below, is an example of a driver that runs
+The vet command, shown below, is an example of a driver that runs
multiple analyzers. It is based on the multichecker package
(see the "Standalone commands" section for details).
- $ go build golang.org/x/tools/cmd/analyze
- $ ./analyze help
- Analyze is a tool for static analysis of Go programs.
+ $ go build golang.org/x/tools/cmd/vet
+ $ ./vet help
+ vet is a tool for static analysis of Go programs.
- Usage: analyze [-flag] [package]
+ Usage: vet [-flag] [package]
Registered analyzers:
@@ -90,7 +90,7 @@
...
unusedresult check for unused results of calls to some functions
- $ ./analyze help unusedresult
+ $ ./vet help unusedresult
unusedresult: check for unused results of calls to some functions
Analyzer flags:
diff --git a/go/analysis/multichecker/multichecker.go b/go/analysis/multichecker/multichecker.go
index a849031..36e5f82 100644
--- a/go/analysis/multichecker/multichecker.go
+++ b/go/analysis/multichecker/multichecker.go
@@ -54,8 +54,9 @@
args := flag.Args()
if len(args) == 0 {
fmt.Fprintln(os.Stderr, strings.ReplaceAll(usage, "PROGNAME", progname))
- fmt.Fprintf(os.Stderr, `Run '%[1]s help' for more detail,
- or '%[1]s help name' for details and flags of a specific analyzer.\n`, progname)
+ fmt.Fprintf(os.Stderr, "Run '%[1]s help' for more detail,\n"+
+ " or '%[1]s help name' for details and flags of a specific analyzer.\n",
+ progname)
os.Exit(1)
}