]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/go: find GOROOT using os.Executable when installed to GOROOT/bin/GOOS_GOARCH
authorBryan C. Mills <bcmills@google.com>
Fri, 18 Aug 2023 19:38:44 +0000 (15:38 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 21 Aug 2023 20:24:22 +0000 (20:24 +0000)
commit9e9556d328c53ed0a4d8b36feee949885d648ba8
tree2f413ad7af0a868403912512ebb32008f57e6337
parente7a1eb066bf6b2e349eeb875ec46561c6928a284
cmd/go: find GOROOT using os.Executable when installed to GOROOT/bin/GOOS_GOARCH

When running make.bash in a cross-compiled configuration
(for example, GOARCH different from GOHOSTARCH), cmd/go
is installed to GOROOT/bin/GOOS_GOARCH instead of GOROOT/bin.

That means that we need to look for GOROOT in both ../.. and ../../..,
not just the former.

Fixes #62119.
Updates #18678.

Change-Id: I283c6a10c46df573ff44da826f870417359226a7
Reviewed-on: https://go-review.googlesource.com/c/go/+/521015
Reviewed-by: Michael Matloob <matloob@golang.org>
Auto-Submit: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/go/internal/cfg/cfg.go
src/cmd/go/testdata/script/goroot_executable.txt
src/cmd/go/testdata/script/goroot_executable_trimpath.txt [new file with mode: 0644]