From 28b5c6ad8b7d40179429cd310cc9fe82783a51e6 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Mon, 16 Jan 2023 21:25:26 +0900 Subject: [PATCH 1/7] Update documentation of go generate Signed-off-by: Shogo Hida --- src/cmd/go/internal/generate/generate.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index 160a8723a055f1..0feff790b34c1b 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -91,6 +91,10 @@ Go generate sets several variables when it runs the generator: $DOLLAR A dollar sign. +Place GOROOT/bin at the beginning of PATH in 'go generate'. +This causes tests and generators that execute 'go' as a subprocess +to use the same go command 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 line. From df83a3558daf4a8218872211741a16a44a6d427a Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Mon, 16 Jan 2023 21:28:33 +0900 Subject: [PATCH 2/7] Update documentation of go test Signed-off-by: Shogo Hida --- src/cmd/go/internal/test/test.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go index e82ea720949777..1b0b10a557fc3e 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -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.) +Place GOROOT/bin at the beginning of PATH in 'go test'. +This causes tests and generators that execute 'go' as a subprocess +to use the same go command as the parent 'go test' command. + Go test runs in two different modes: The first, called local directory mode, occurs when go test is From 530d7aafd9c303d3ed4c59201b6b1fac86fc28a1 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Sat, 11 Feb 2023 20:27:03 +0900 Subject: [PATCH 3/7] Fix texts Signed-off-by: Shogo Hida --- src/cmd/go/internal/generate/generate.go | 9 +++++---- src/cmd/go/internal/test/test.go | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index 0feff790b34c1b..c87e7eb84557a3 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -90,10 +90,11 @@ Go generate sets several variables when it runs the generator: generator, containing the Go toolchain and standard library. $DOLLAR A dollar sign. - -Place GOROOT/bin at the beginning of PATH in 'go generate'. -This causes tests and generators that execute 'go' as a subprocess -to use the same go command as the parent 'go generate' command. + $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 1b0b10a557fc3e..97f2dbdbe6cd32 100644 --- a/src/cmd/go/internal/test/test.go +++ b/src/cmd/go/internal/test/test.go @@ -87,9 +87,9 @@ 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.) -Place GOROOT/bin at the beginning of PATH in 'go test'. -This causes tests and generators that execute 'go' as a subprocess -to use the same go command as the parent 'go test' command. +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: From 3cdec9a5fad15ce9bf5fa149953c40ddd7e26cd1 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Tue, 14 Feb 2023 07:55:15 +0900 Subject: [PATCH 4/7] Add tab spaces Signed-off-by: Shogo Hida --- src/cmd/go/internal/generate/generate.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index c87e7eb84557a3..255dacfde488b7 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -91,10 +91,10 @@ Go generate sets several variables when it runs the generator: $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. + 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 From 66a841c4edddc878dc079f7cf6d8660995f85e74 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Sun, 19 Feb 2023 14:38:35 +0900 Subject: [PATCH 5/7] Update alldocs.go Signed-off-by: Shogo Hida --- src/cmd/go/alldocs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 4314d771fba605..1e097dd96f3cf5 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -567,6 +567,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 From 7bb7382f49c83232496001c0b855c16806c2ed65 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Wed, 10 May 2023 22:15:48 +0900 Subject: [PATCH 6/7] Replace spaces with 2 tabs --- src/cmd/go/internal/generate/generate.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cmd/go/internal/generate/generate.go b/src/cmd/go/internal/generate/generate.go index 255dacfde488b7..50c68924797502 100644 --- a/src/cmd/go/internal/generate/generate.go +++ b/src/cmd/go/internal/generate/generate.go @@ -91,10 +91,10 @@ Go generate sets several variables when it runs the generator: $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. + 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 From 697c255ece18cd4772b76d62991474a7da2536d8 Mon Sep 17 00:00:00 2001 From: Shogo Hida Date: Wed, 10 May 2023 23:33:14 +0900 Subject: [PATCH 7/7] Add paragraph --- src/cmd/go/alldocs.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go index 1e097dd96f3cf5..8bcbd3f7647eec 100644 --- a/src/cmd/go/alldocs.go +++ b/src/cmd/go/alldocs.go @@ -1708,6 +1708,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