]> Cypherpunks repositories - gostls13.git/commitdiff
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>
Wed, 10 May 2023 15:11:42 +0000 (15:11 +0000)
Fixes #57050

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>
src/cmd/go/alldocs.go
src/cmd/go/internal/generate/generate.go
src/cmd/go/internal/test/test.go

index 4314d771fba6057e72170a9c9c6c362ee3e4d2cd..8bcbd3f7647eecc71a0cdd2a536c3c7fabfc5543 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 160a8723a055f169503e8492a2a24f00c95b01e6..50c6892479750231e5d273487faae2d533453d35 100644 (file)
@@ -90,6 +90,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 e82ea72094977740f57f1a87203a240ea5479222..97f2dbdbe6cd32c64d09d4353546cda1b20e8547 100644 (file)
@@ -87,6 +87,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