-
Notifications
You must be signed in to change notification settings - Fork 17.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
go/build: avoid setting Default.GOROOT when runtime.GOROOT() is empty
Previously, we called path.Clean on the value of runtime.GOROOT() even if it was empty, which would set it explicitly to ".". That would cause (*Context).importGo to assume that errors resolving paths in GOROOT are fatal and return early: https://cs.opensource.google/go/go/+/master:src/go/build/build.go;l=1121-1127;drc=38174b3a3514629b84dcd76878b2f536b189dd7b If we instead leave it empty (and are in module mode), then importGo will fall back to letting the 'go' command resolve the path, which may succeed if the 'go' command can infer the correct GOROOT (from its own stamped-in default GOROOT or executable path). Fixes #51483 Change-Id: I44dce7cec6c3d1c86670e629ddfbca8be461130c Reviewed-on: https://go-review.googlesource.com/c/go/+/391805 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
- Loading branch information
Bryan C. Mills
committed
Mar 18, 2022
1 parent
58631ba
commit 6378c0e
Showing
3 changed files
with
27 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters