Skip to content

Commit e6df179

Browse files
committed
cmd/dist: move GOPATH setting from init to bootstrap
CL 168697 unconditionally set GOPATH in dist, which broke the misc-vet-vetall builder, because cmd/vet/all depends on GOPATH. Fixes #30971 Change-Id: If6a58e054c6a4fedc2ea506a2c443348489c91f3 Reviewed-on: https://go-review.googlesource.com/c/go/+/169217 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Jay Conrod <[email protected]>
1 parent 50fe946 commit e6df179

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/cmd/dist/build.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,6 @@ func xinit() {
235235
// make.bash really does start from a clean slate.
236236
os.Setenv("GOCACHE", pathf("%s/pkg/obj/go-build", goroot))
237237

238-
// Set GOPATH to an internal directory. We shouldn't actually
239-
// need to store files here, since the toolchain won't
240-
// depend on modules outside of vendor directories, but if
241-
// GOPATH points somewhere else (e.g., to GOROOT), the
242-
// go tool may complain.
243-
os.Setenv("GOPATH", pathf("%s/pkg/obj/gopath", goroot))
244-
245238
// Make the environment more predictable.
246239
os.Setenv("LANG", "C")
247240
os.Setenv("LANGUAGE", "en_US.UTF8")
@@ -1211,6 +1204,13 @@ func cmdbootstrap() {
12111204

12121205
xflagparse(0)
12131206

1207+
// Set GOPATH to an internal directory. We shouldn't actually
1208+
// need to store files here, since the toolchain won't
1209+
// depend on modules outside of vendor directories, but if
1210+
// GOPATH points somewhere else (e.g., to GOROOT), the
1211+
// go tool may complain.
1212+
os.Setenv("GOPATH", pathf("%s/pkg/obj/gopath", goroot))
1213+
12141214
if debug {
12151215
// cmd/buildid is used in debug mode.
12161216
toolchain = append(toolchain, "cmd/buildid")

0 commit comments

Comments
 (0)