]> Cypherpunks.ru repositories - gostls13.git/commitdiff
[release-branch.go1.20] cmd/go/internal: update documentation of go test and go generate
authorShogo Hida <shogo.hida@gmail.com>
Wed, 10 May 2023 14:41:06 +0000 (14:41 +0000)
committerGopher Robot <gobot@golang.org>
Tue, 30 May 2023 18:12:39 +0000 (18:12 +0000)
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>

src/cmd/go/alldocs.go
src/cmd/go/internal/generate/generate.go
src/cmd/go/internal/test/test.go

index 84afcab7a036557e039ebbf2d7bb1ffd6902c186..08bfb3e7a2a0fed89ca43ff8e71eccb67b6b7269 100644 (file)
 //             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
 // 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
index 3eda6c71453f16d84acbeac206f15cb94e105c63..2664c5e8d9b6553df82a7fb68a3b1069a3f395a3 100644 (file)
@@ -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
index fe6e733538a3fa8a3b7d91a7f662736e9d2f5478..28bfabdcb6f9621e5ba0a5c2cd54406a62e7d70b 100644 (file)
@@ -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