10000 go/packages: add GOROOT env to avoid TestTarget failure in OpenBSD · golang/tools@ac39815 · GitHub
[go: up one dir, main page]

Skip to content

Commit ac39815

Browse files
linsitematloob
authored andcommitted
go/packages: add GOROOT env to avoid TestTarget failure in OpenBSD
When running tests in OpenBSD if 'go' is built with -trimpath, the TestTarget will always fail. Because when invoked without proper environments, 'go' itself fails to find the GOROOT path. Fixes golang/go#70891 Change-Id: I829b77686ae24d869653365f3e44e457c76b46bb GitHub-Last-Rev: 6e1311b GitHub-Pull-Request: #552 Reviewed-on: https://go-review.googlesource.com/c/tools/+/637961 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
1 parent 39e1a8c commit ac39815

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

go/packages/packages_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3339,7 +3339,7 @@ func main() {
33393339

33403340
pkgs, err := packages.Load(&packages.Config{
33413341
Mode: packages.NeedName | packages.NeedTarget,
3342-
Env: []string{"GOPATH=" + gopath, "GO111MODULE=off"},
3342+
Env: append(os.Environ(), "GOPATH=" + gopath, "GO111MODULE=off"),
33433343
}, filepath.Join(gopath, "src", "..."))
33443344
if err != nil {
33453345
t.Fatal(err)

0 commit comments

Comments
 (0)
0