]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/vet: improve documentation for flags, slightly
authorRob Pike <r@golang.org>
Mon, 4 Apr 2016 20:22:34 +0000 (13:22 -0700)
committerRob Pike <r@golang.org>
Mon, 11 Apr 2016 22:35:22 +0000 (22:35 +0000)
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/21495
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/cmd/vet/doc.go
src/cmd/vet/main.go

index 2b5e8fcb597dc9bbefd9eb426b4b07190dcf8e25..c697f3bc36269647a695ff44f78bb3be3f5d3cb9 100644 (file)
@@ -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
index a2142dcabbfdfdc83465573ea0ed41b81debffdc..8212a14f0398ba472c331ea6f1265a9d92db5647 100644 (file)
@@ -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")