diff options
| author | matloob <matloob@golang.org> | 2025-12-29 13:16:53 -0500 |
|---|---|---|
| committer | Michael Matloob <matloob@golang.org> | 2026-03-31 11:40:13 -0700 |
| commit | 2000e27ea6a644ea3623db201d8ba2818e8f5838 (patch) | |
| tree | 6777d8bf074776e89adead1cd7c2af8130114756 /src/cmd/internal/script | |
| parent | f9d2c2fd692e3aa81b80fbe1d0479866abff54df (diff) | |
| download | go-2000e27ea6a644ea3623db201d8ba2818e8f5838.tar.xz | |
cmd/go/internal/doc: use internal go command logic to load packages
We've been using go/build to load packages, and that doesn't
always do the right thing, because it doesn't have the same
context and settings that the go command uses to load packages.
Use the go command's loader to load packages.
This CL doesn't remove the logic for searching for matching
packages in dirs.go. A next step would be to remove that so
all the matching is also done with the go command's logic.
Fixes #75976
Change-Id: I3c76d9a54dc88648bb7c76a17afad8cb6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/733200
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Sean Liao <sean@liao.dev>
Reviewed-by: Junyang Shao <shaojunyang@google.com>
Reviewed-by: Michael Matloob <matloob@google.com>
Diffstat (limited to 'src/cmd/internal/script')
| -rw-r--r-- | src/cmd/internal/script/scripttest/readme.go | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/cmd/internal/script/scripttest/readme.go b/src/cmd/internal/script/scripttest/readme.go index af7397223f..8f333b06c2 100644 --- a/src/cmd/internal/script/scripttest/readme.go +++ b/src/cmd/internal/script/scripttest/readme.go @@ -37,6 +37,7 @@ func checkScriptReadme(t *testing.T, engine *script.Engine, env []string, script doc := new(strings.Builder) cmd := testenv.Command(t, gotool, "doc", "cmd/internal/script") + cmd.Dir = t.TempDir() // make sure the test is not running inside the std or cmd module of another GOROOT cmd.Env = env cmd.Stdout = doc if err := cmd.Run(); err != nil { |
