mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/go: add -C flag
The -C flag is like tar -C or make -C: it changes to the named directory early in command startup, before anything else happens. Fixes #50332. Change-Id: I8e4546f69044cb3a028d4d26dfba482b08cb845d Reviewed-on: https://go-review.googlesource.com/c/go/+/421436 Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Russ Cox <rsc@golang.org>
This commit is contained in:
parent
fb4f7fdb26
commit
2af48cbb7d
24 changed files with 136 additions and 9 deletions
|
|
@ -58,6 +58,10 @@ will be written to that directory.
|
|||
The build flags are shared by the build, clean, get, install, list, run,
|
||||
and test commands:
|
||||
|
||||
-C dir
|
||||
Change to dir before running the command.
|
||||
Any files named on the command line are interpreted after
|
||||
changing directories.
|
||||
-a
|
||||
force rebuilding of packages that are already up-to-date.
|
||||
-n
|
||||
|
|
@ -282,6 +286,7 @@ const (
|
|||
// install, list, run, and test commands.
|
||||
func AddBuildFlags(cmd *base.Command, mask BuildFlagMask) {
|
||||
base.AddBuildFlagsNX(&cmd.Flag)
|
||||
base.AddChdirFlag(&cmd.Flag)
|
||||
cmd.Flag.BoolVar(&cfg.BuildA, "a", false, "")
|
||||
cmd.Flag.IntVar(&cfg.BuildP, "p", cfg.BuildP, "")
|
||||
if mask&OmitVFlag == 0 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue