diff options
author | Bryan C. Mills <bcmills@google.com> | 2019-12-11 09:12:25 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2020-02-25 20:54:34 +0000 |
commit | 583419e5d2a893e369095355035f4ebb18bb85f8 (patch) | |
tree | d74fe04583493d4df0354f1806f2de807b3de6a4 /src/cmd/go/internal/work/build.go | |
parent | 8e2dad5529d250d548e87720741d20e88a1dfaf2 (diff) | |
download | go-583419e5d2a893e369095355035f4ebb18bb85f8.tar.gz go-583419e5d2a893e369095355035f4ebb18bb85f8.zip |
cmd/go/internal/{test,vet}: use a standard flag.FlagSet to parse flags
This removes much of the complexity of the implementation and use of
the cmd/go/internal/cmdflag package, and makes the behavior of GOFLAGS
in 'go test' and 'go vet' more consistent with other subcommands.
Some of the complexity reduction has been offset by code comments and
bug fixes, particularly for the handling of GOPATH arguments and flag
terminators ('--').
Fixes #32471
Fixes #18682
Change-Id: I1f6e46a7c679062e1e409e44a2b9f03b9172883b
Reviewed-on: https://go-review.googlesource.com/c/go/+/211358
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/work/build.go')
-rw-r--r-- | src/cmd/go/internal/work/build.go | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/go/internal/work/build.go b/src/cmd/go/internal/work/build.go index e3b25c937c..7146c9ce00 100644 --- a/src/cmd/go/internal/work/build.go +++ b/src/cmd/go/internal/work/build.go @@ -232,6 +232,7 @@ const ( DefaultBuildFlags BuildFlagMask = 0 OmitModFlag BuildFlagMask = 1 << iota OmitModCommonFlags + OmitVFlag ) // AddBuildFlags adds the flags common to the build, clean, get, @@ -240,7 +241,9 @@ func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) { cmd.Flag.BoolVar(&cfg.BuildA, "a", false, "") cmd.Flag.BoolVar(&cfg.BuildN, "n", false, "") cmd.Flag.IntVar(&cfg.BuildP, "p", cfg.BuildP, "") - cmd.Flag.BoolVar(&cfg.BuildV, "v", false, "") + if mask&OmitVFlag == 0 { + cmd.Flag.BoolVar(&cfg.BuildV, "v", false, "") + } cmd.Flag.BoolVar(&cfg.BuildX, "x", false, "") cmd.Flag.Var(&load.BuildAsmflags, "asmflags", "") |