Skip to content

Commit bf1225f

Browse files
committed
src/goEnv: unset GOOS/GOARCH/GOROOT/... from tool installation env
Tool installation is to build tools that would run in the host machine. Applying GOOS/GOARCH/GOROOT/GOFLAGS/GOENV set to build a cross-platform project is not the right choice. Unset them and let the `go` command figure out. There could be other environment variables that would affect build (GCCGO, ..), and we will consider unsetting them. Update #628 Change-Id: I295a0ae455aa2624550a16f69686bdf191fe41fd Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/264323 Run-TryBot: Hyang-Ah Hana Kim <[email protected]> TryBot-Result: kokoro <[email protected]> Trust: Hyang-Ah Hana Kim <[email protected]> Reviewed-by: Suzy Mueller <[email protected]>
1 parent d7563f6 commit bf1225f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/goEnv.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ export function toolInstallationEnvironment(): NodeJS.Dict<string> {
3939
}
4040
env['GOPATH'] = toolsGopath;
4141

42+
// Unset env vars that would affect tool build process: 'GOROOT', 'GOOS', 'GOARCH', ...
43+
// Tool installation should be done for the host OS/ARCH (GOHOSTOS/GOHOSTARCH) with
44+
// the default setup.
45+
delete env['GOOS'];
46+
delete env['GOARCH'];
47+
delete env['GOROOT'];
48+
delete env['GOFLAGS'];
49+
delete env['GOENV'];
50+
4251
return env;
4352
}
4453

0 commit comments

Comments
 (0)