mirror of
https://github.com/golang/go
synced 2024-11-14 08:30:25 -07:00
cmd/vet: remove -test flag
-test flag is a testing only flag that enables all vet checks. It was needed because there was no way to run all vet checks in a single command invocation. However it is possible to do this now by combining -all and -shadow flags. Also a recently added -tests flag is similarly named, having both -test and -tests can be confusing. Change-Id: Ie5bacbe0bef5c8409eeace46f16141fa4e782c32 Reviewed-on: https://go-review.googlesource.com/20006 Reviewed-by: Rob Pike <r@golang.org> Run-TryBot: Rob Pike <r@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
bcce5bdabd
commit
b8a2e25f55
@ -198,7 +198,5 @@ These flags configure the behavior of vet:
|
|||||||
For more information, see the discussion of the -printf flag.
|
For more information, see the discussion of the -printf flag.
|
||||||
-shadowstrict
|
-shadowstrict
|
||||||
Whether to be strict about shadowing; can be noisy.
|
Whether to be strict about shadowing; can be noisy.
|
||||||
-test
|
|
||||||
For testing only: sets -all and -shadow.
|
|
||||||
*/
|
*/
|
||||||
package main // import "golang.org/x/tools/cmd/vet"
|
package main // import "golang.org/x/tools/cmd/vet"
|
||||||
|
@ -25,7 +25,6 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
verbose = flag.Bool("v", false, "verbose")
|
verbose = flag.Bool("v", false, "verbose")
|
||||||
testFlag = flag.Bool("test", false, "for testing only: sets -all and -shadow")
|
|
||||||
tags = flag.String("tags", "", "comma-separated list of build tags to apply when parsing")
|
tags = flag.String("tags", "", "comma-separated list of build tags to apply when parsing")
|
||||||
tagList = []string{} // exploded version of tags flag; set in main
|
tagList = []string{} // exploded version of tags flag; set in main
|
||||||
)
|
)
|
||||||
@ -116,9 +115,6 @@ func (ts triState) IsBoolFlag() bool {
|
|||||||
|
|
||||||
// vet tells whether to report errors for the named check, a flag name.
|
// vet tells whether to report errors for the named check, a flag name.
|
||||||
func vet(name string) bool {
|
func vet(name string) bool {
|
||||||
if *testFlag {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
return report[name].isTrue()
|
return report[name].isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,8 @@ func Vet(t *testing.T, files []string) {
|
|||||||
flags := []string{
|
flags := []string{
|
||||||
"./" + binary,
|
"./" + binary,
|
||||||
"-printfuncs=Warn:1,Warnf:1",
|
"-printfuncs=Warn:1,Warnf:1",
|
||||||
"-test", // TODO: Delete once -shadow is part of -all.
|
"-all",
|
||||||
|
"-shadow",
|
||||||
}
|
}
|
||||||
cmd := exec.Command(errchk, append(flags, files...)...)
|
cmd := exec.Command(errchk, append(flags, files...)...)
|
||||||
if !run(cmd, t) {
|
if !run(cmd, t) {
|
||||||
|
Loading…
Reference in New Issue
Block a user