Skip to content

Commit 6e1311b

Browse files
committed
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
1 parent 6d4eee4 commit 6e1311b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: go/packages/packages_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3363,7 +3363,7 @@ func main() {
33633363

33643364
pkgs, err := packages.Load(&packages.Config{
33653365
Mode: packages.NeedName | packages.NeedTarget,
3366-
Env: []string{"GOPATH=" + gopath, "GO111MODULE=off"},
3366+
Env: append(os.Environ(), "GOPATH=" + gopath, "GO111MODULE=off"),
33673367
}, filepath.Join(gopath, "src", "..."))
33683368
if err != nil {
33693369
t.Fatal(err)

0 commit comments

Comments
 (0)