aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/alldocs.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2022-08-05 13:09:20 -0400
committerGopher Robot <gobot@golang.org>2022-11-03 12:16:35 +0000
commit2af48cbb7d85e5fdc635e75b99f949010c607786 (patch)
tree39f2abed89888e1b93967d99de0d5752107677e7 /src/cmd/go/alldocs.go
parentfb4f7fdb26da9ed0fee6beab280c84b399edaa42 (diff)
downloadgo-2af48cbb7d85e5fdc635e75b99f949010c607786.tar.gz
go-2af48cbb7d85e5fdc635e75b99f949010c607786.zip
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>
Diffstat (limited to 'src/cmd/go/alldocs.go')
-rw-r--r--src/cmd/go/alldocs.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index a8206c475cc..051cf25996a 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -100,6 +100,10 @@
// 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
@@ -1233,6 +1237,8 @@
// referred to indirectly. For the full set of modules available to a build,
// use 'go list -m -json all'.
//
+// Edit also provides the -C, -n, and -x build flags.
+//
// See https://golang.org/ref/mod#go-mod-edit for more about 'go mod edit'.
//
// # Print module requirement graph
@@ -1797,7 +1803,7 @@
//
// Usage:
//
-// go vet [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
+// go vet [-C dir] [-n] [-x] [-vettool prog] [build flags] [vet flags] [packages]
//
// Vet runs the Go vet command on the packages named by the import paths.
//
@@ -1806,6 +1812,7 @@
// For a list of checkers and their flags, see 'go tool vet help'.
// For details of a specific checker such as 'printf', see 'go tool vet help printf'.
//
+// The -C flag changes to dir before running the 'go vet' command.
// The -n flag prints commands that would be executed.
// The -x flag prints commands as they are executed.
//