diff options
author | Konstantin Shaposhnikov <k.shaposhnikov@gmail.com> | 2015-10-26 20:10:54 +0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2015-12-05 04:07:36 +0000 |
commit | 3fb9e08758df3f2ace772271c73692e483d85a80 (patch) | |
tree | 68bbfec7569339b59dbca419731e047f4db87e18 /src/cmd/vet/main.go | |
parent | e0c05fcb5b92dee3ab130e41c574b31625514dfe (diff) | |
download | go-3fb9e08758df3f2ace772271c73692e483d85a80.tar.gz go-3fb9e08758df3f2ace772271c73692e483d85a80.zip |
cmd/vet: make "-all -shadow" mean all default checks and -shadow
Prior to this change "go tool vet -all -shadow" ran only -shadow check.
Also fix godoc package path in the usage text.
Fixes #13020
Change-Id: I87c60d6b06a02106ae8bff56adb79df032cc4646
Reviewed-on: https://go-review.googlesource.com/16325
Reviewed-by: Russ Cox <rsc@golang.org>
Diffstat (limited to 'src/cmd/vet/main.go')
-rw-r--r-- | src/cmd/vet/main.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/cmd/vet/main.go b/src/cmd/vet/main.go index fbba009d11..23c041bef3 100644 --- a/src/cmd/vet/main.go +++ b/src/cmd/vet/main.go @@ -32,9 +32,8 @@ var ( var exitCode = 0 -// "all" is here only for the appearance of backwards compatibility. -// It has no effect; the triState flags do the work. -var all = flag.Bool("all", true, "check everything; disabled if any explicit check is requested") +// "-all" flag enables all non-experimental checks +var all = triStateFlag("all", unset, "enable all non-experimental checks") // Flags to control which individual checks to perform. var report = map[string]*triState{ @@ -169,7 +168,7 @@ func Usage() { 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, "For more information run\n") - fmt.Fprintf(os.Stderr, "\tgodoc golang.org/x/tools/cmd/vet\n\n") + fmt.Fprintf(os.Stderr, "\tgodoc cmd/vet\n\n") fmt.Fprintf(os.Stderr, "Flags:\n") flag.PrintDefaults() os.Exit(2) @@ -198,8 +197,9 @@ func main() { flag.Parse() // If any flag is set, we run only those checks requested. - // If no flags are set true, set all the non-experimental ones not explicitly set (in effect, set the "-all" flag). - if setTrueCount == 0 { + // If all flag is set true or if no flags are set true, set all the non-experimental ones + // not explicitly set (in effect, set the "-all" flag). + if setTrueCount == 0 || *all == setTrue { for name, setting := range report { if *setting == unset && !experimental[name] { *setting = setTrue |