diff options
author | Shogo Hida <shogo.hida@gmail.com> | 2023-05-10 14:41:06 +0000 |
---|---|---|
committer | Gopher Robot <gobot@golang.org> | 2023-05-30 18:12:39 +0000 |
commit | b249ec56553becadd90fac7ee9f843f45c1d3774 (patch) | |
tree | 7c6d8bbcf88a89438898ca2b291533090125b32e | |
parent | 4b95fc1e6cdd4a60e8eb7e460e26254e35396107 (diff) | |
download | go-b249ec56553becadd90fac7ee9f843f45c1d3774.tar.gz go-b249ec56553becadd90fac7ee9f843f45c1d3774.zip |
[release-branch.go1.20] cmd/go/internal: update documentation of go test and go generate
For #57050.
Fixes #60458.
Change-Id: I46cac667ff78ac171c878f4366f8f01f58f1d27d
GitHub-Last-Rev: 697c255ece18cd4772b76d62991474a7da2536d8
GitHub-Pull-Request: golang/go#57814
Reviewed-on: https://go-review.googlesource.com/c/go/+/461683
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
(cherry picked from commit 93d9035c9e8b129578d3a177fd90eb308e44a597)
Reviewed-on: https://go-review.googlesource.com/c/go/+/499218
Run-TryBot: Dmitri Shuralyov <dmitshur@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@google.com>
-rw-r--r-- | src/cmd/go/alldocs.go | 9 | ||||
-rw-r--r-- | src/cmd/go/internal/generate/generate.go | 5 | ||||
-rw-r--r-- | src/cmd/go/internal/test/test.go | 4 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 84afcab7a0..08bfb3e7a2 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -565,6 +565,11 @@ // generator, containing the Go toolchain and standard library. // $DOLLAR // A dollar sign. +// $PATH +// The $PATH of the parent process, with $GOROOT/bin +// placed at the beginning. This causes generators +// that execute 'go' commands to use the same 'go' +// as the parent 'go generate' command. // // Other than variable substitution and quoted-string evaluation, no // special processing such as "globbing" is performed on the command @@ -1697,6 +1702,10 @@ // error. (The go command's standard error is reserved for printing // errors building the tests.) // +// The go command places $GOROOT/bin at the beginning of $PATH +// in the test's environment, so that tests that execute +// 'go' commands use the same 'go' as the parent 'go test' command. +// // Go test runs in two different modes: // // The first, called local directory mode, occurs when go test is diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index 3eda6c7145..2664c5e8d9 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -89,6 +89,11 @@ Go generate sets several variables when it runs the generator: generator, containing the Go toolchain and standard library. $DOLLAR A dollar sign. + $PATH + The $PATH of the parent process, with $GOROOT/bin + placed at the beginning. This causes generators + that execute 'go' commands to use the same 'go' + as the parent 'go generate' command. Other than variable substitution and quoted-string evaluation, no special processing such as "globbing" is performed on the command diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index fe6e733538..28bfabdcb6 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -86,6 +86,10 @@ standard output, even if the test printed them to its own standard error. (The go command's standard error is reserved for printing errors building the tests.) +The go command places $GOROOT/bin at the beginning of $PATH +in the test's environment, so that tests that execute +'go' commands use the same 'go' as the parent 'go test' command. + Go test runs in two different modes: The first, called local directory mode, occurs when go test is |