-
Notifications
You must be signed in to change notification settings - Fork 18k
go/build: Default.Import fails for standard-library packages when built with -trimpath #51483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Related to #51473. It is broken in more cases than just |
Change https://go.dev/cl/391801 mentions this issue: |
Change https://go.dev/cl/391814 mentions this issue: |
Change https://go.dev/cl/391809 mentions this issue: |
Change https://go.dev/cl/391813 mentions this issue: |
Change https://go.dev/cl/391811 mentions this issue: |
Change https://go.dev/cl/391805 mentions this issue: |
This test uses testgo to run 'go list', so it should use the correct GOROOT for testgo. (This may be particularly relevant when the test binary itself is build with -trimpath, in which case runtime.GOROOT() is not valid.) Updates #51483 Change-Id: I79b310f88e3a200122d6289073df1385e3e97cca Reviewed-on: https://go-review.googlesource.com/c/go/+/391801 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Trust: Daniel Martí <mvdan@mvdan.cc>
Change https://go.dev/cl/393366 mentions this issue: |
Updates #51483. Change-Id: I13d8e58b30639d8a5ed3c9e8b72c8bbaa6a6f1cc Reviewed-on: https://go-review.googlesource.com/c/go/+/391813 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
…n $PATH For #51483. Change-Id: I6150fdf97763d858e9ab012e807515da3387c25f Reviewed-on: https://go-review.googlesource.com/c/go/+/393366 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
When the test binary is built with the -trimpath flag, runtime.GOROOT() is invalid, and must not be used to locate GOROOT/lib/time/zoneinfo.zip. (We can use other sources instead.) However, the test for the package expects zoneinfo.zip to definitely exist. 'go test' runs the test binary in the directory containing its source code — in this case GOROOT/src/time — so we can use that information to find the zoneinfo.zip file when runtime.GOROOT isn't available. For #51483 Change-Id: I9de35252a988d146b5d746794323214d400e64e5 Reviewed-on: https://go-review.googlesource.com/c/go/+/391814 Trust: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
Also update cmd/dist to avoid setting gcflags and ldflags explicitly when the set of flags to be set is empty (a verbose way of specifying the default behavior). Stamping was disabled for the Go standard library in CL 356014 due to the cmd/dist flags causing cmd/go to (correctly) report the resulting binaries as stale. With cmd/dist fixed, we can also remove the special case in cmd/go, which will allow tests of binaries in 'cmd' to read the build info embedded in the test binary. That build info may be useful to determine (say) whether runtime.GOROOT ought to work without GOROOT set in the environment. For #51483 Updates #37475 Change-Id: I64d04f5990190094eb6c0522db829d3bdfa50ef3 Reviewed-on: https://go-review.googlesource.com/c/go/+/391809 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>
For #51483 Change-Id: I4546c20cf968b595020a1eba888fe1d9a1c6cfc5 Reviewed-on: https://go-review.googlesource.com/c/go/+/391811 Reviewed-by: Russ Cox <rsc@golang.org> Trust: Bryan Mills <bcmills@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Execute
go run
for the following program, with or without-trimpath
.What did you expect to see?
Successful output in both cases:
go/build
already falls back togo list
in some cases, andgo list
knows where to find its ownGOROOT
.What did you see instead?
The text was updated successfully, but these errors were encountered: