From f8bfdc9eda4a065b88e5d7ab968957d9c84694bf Mon Sep 17 00:00:00 2001 From: Jay Conrod Date: Mon, 11 Oct 2021 15:51:10 -0700 Subject: [PATCH] cmd/go: adjust documentation mentioning 'go get' In module-aware mode, 'go get' no longer builds or installs packages. - 'go generate' explains build commands do not run generate commands. 'go get' is no longer a build command, so this CL removes mention of it. - 'go get' will continue to accept build flags, but they're ignored. The documentation no longer mentions them, though it does mention -x for printing VCS commands. For #43684 Change-Id: I1eea7241eecf72ba9f98238b729d91cc77ec7665 Reviewed-on: https://go-review.googlesource.com/c/go/+/355209 Trust: Jay Conrod Run-TryBot: Jay Conrod TryBot-Result: Go Bot Reviewed-by: Bryan C. Mills --- src/cmd/go/alldocs.go | 9 ++++++--- src/cmd/go/internal/generate/generate.go | 2 +- src/cmd/go/internal/modget/get.go | 7 +++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 8a2109619d..c3e4179025 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -498,7 +498,7 @@ // files. Those commands can run any process but the intent is to // create or update Go source files. // -// Go generate is never run automatically by go build, go get, go test, +// Go generate is never run automatically by go build, go test, // and so on. It must be run explicitly. // // Go generate scans the file for directives, which are lines of @@ -644,8 +644,7 @@ // // See 'go help install' or https://golang.org/ref/mod#go-install for details. // -// In addition to build flags (listed in 'go help build') 'go get' accepts the -// following flags. +// 'go get' accepts the following flags. // // The -t flag instructs get to consider modules needed to build tests of // packages specified on the command line. @@ -660,6 +659,10 @@ // When the -t and -u flags are used together, get will update // test dependencies as well. // +// The -x flag prints commands as they are executed. This is useful for +// debugging version control commands when a module is downloaded directly +// from a repository. +// // For more about modules, see https://golang.org/ref/mod. // // For more about specifying packages, see 'go help packages'. diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index d7f2eb4610..5981e5ecdb 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -38,7 +38,7 @@ Generate runs commands described by directives within existing files. Those commands can run any process but the intent is to create or update Go source files. -Go generate is never run automatically by go build, go get, go test, +Go generate is never run automatically by go build, go test, and so on. It must be run explicitly. Go generate scans the file for directives, which are lines of diff --git a/src/cmd/go/internal/modget/get.go b/src/cmd/go/internal/modget/get.go index 4d87d2670d..c634512072 100644 --- a/src/cmd/go/internal/modget/get.go +++ b/src/cmd/go/internal/modget/get.go @@ -83,8 +83,7 @@ current directory. For example: See 'go help install' or https://golang.org/ref/mod#go-install for details. -In addition to build flags (listed in 'go help build') 'go get' accepts the -following flags. +'go get' accepts the following flags. The -t flag instructs get to consider modules needed to build tests of packages specified on the command line. @@ -99,6 +98,10 @@ but changes the default to select patch releases. When the -t and -u flags are used together, get will update test dependencies as well. +The -x flag prints commands as they are executed. This is useful for +debugging version control commands when a module is downloaded directly +from a repository. + For more about modules, see https://golang.org/ref/mod. For more about specifying packages, see 'go help packages'. -- 2.50.0