]> Cypherpunks repositories - gostls13.git/commitdiff
[release-branch.go1.19] 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:41 +0000 (18:12 +0000)
For #57050.
Fixes #60457.

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/+/499295
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 a3c1fecb91b6dda01c78ccb91176899d8cb9acf0..88d6c2d6bb66bed9a1ab62272bac28fa3906c09c 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 65e7148aa87057eb55cf6172912998851df9a607..18d4a20952bc166e89e2452994dee9807f18afc9 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 028db84cc462bc7a72683c741c7cde0407a1e4cd..4635558718ffae9893cb750e354d1d862f77b308 100644 (file)
@@ -90,6 +90,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