Commit d1feddb7 authored by Rob Pike's avatar Rob Pike

cmd/vet: improve documentation for flags, slightly

The way that -all works was unclear from the documentation and made
worse by recent changes to the flag package. Improve matters by making
the help message say "default true" for the tests that do default to true,
and tweak some of the wording.

Before:

Usage of vet:
	vet [flags] directory...
	vet [flags] files... # Must be a single package
For more information run
	go doc cmd/vet

Flags:
  -all
    	enable all non-experimental checks (default unset)
  -asmdecl
    	check assembly against Go declarations (default unset)
...

After:

Usage of vet:
	vet [flags] directory...
	vet [flags] files... # Must be a single package
By default, -all is set and all non-experimental checks are run.
For more information run
	go doc cmd/vet

Flags:
  -all
    	enable all non-experimental checks (default true)
  -asmdecl
    	check assembly against Go declarations (default true)
...

Change-Id: Ie94b27381a9ad2382a10a7542a93bce1d59fa8f5
Reviewed-on: https://go-review.googlesource.com/21495Reviewed-by: default avatarAndrew Gerrand <adg@golang.org>
parent a4650a21
......@@ -29,11 +29,10 @@ check every possible problem and depends on unreliable heuristics
so it should be used as guidance only, not as a firm indicator of
program correctness.
By default all checks are performed. If any flags are explicitly set
to true, only those tests are run. Conversely, if any flag is
explicitly set to false, only those tests are disabled.
Thus -printf=true runs the printf check, -printf=false runs all checks
except the printf check.
By default the -all flag is set so all checks are performed.
If any flags are explicitly set to true, only those tests are run. Conversely, if
any flag is explicitly set to false, only those tests are disabled. Thus -printf=true
runs the printf check, -printf=false runs all checks except the printf check.
Available checks:
......@@ -194,4 +193,4 @@ These flags configure the behavior of vet:
-shadowstrict
Whether to be strict about shadowing; can be noisy.
*/
package main // import "golang.org/x/tools/cmd/vet"
package main
......@@ -100,7 +100,7 @@ func (ts *triState) Set(value string) error {
func (ts *triState) String() string {
switch *ts {
case unset:
return "unset"
return "true" // An unset flag will be set by -all, so defaults to true.
case setTrue:
return "true"
case setFalse:
......@@ -164,6 +164,7 @@ func Usage() {
fmt.Fprintf(os.Stderr, "Usage of %s:\n", os.Args[0])
fmt.Fprintf(os.Stderr, "\tvet [flags] directory...\n")
fmt.Fprintf(os.Stderr, "\tvet [flags] files... # Must be a single package\n")
fmt.Fprintf(os.Stderr, "By default, -all is set and all non-experimental checks are run.\n")
fmt.Fprintf(os.Stderr, "For more information run\n")
fmt.Fprintf(os.Stderr, "\tgo doc cmd/vet\n\n")
fmt.Fprintf(os.Stderr, "Flags:\n")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment