cmd/upload: use specified go version for building
There's an optional -go flag to specify Go version for compilation.
Use it in both invocations of the "go" command, not just the first.
This is a followup to CL 207420 where the -go flag was added.
Change-Id: Ic33b9acf194fb8fda582d3495e4247fec36218e0
Reviewed-on: https://go-review.googlesource.com/c/build/+/216837
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cmd/upload/upload.go b/cmd/upload/upload.go
index b3733a3..6b8edbc 100644
--- a/cmd/upload/upload.go
+++ b/cmd/upload/upload.go
@@ -207,12 +207,13 @@
goos, goarch = v[0], v[1]
}
+ goBin := goCmd()
env := append(os.Environ(), "GOOS="+goos, "GOARCH="+goarch)
if *extraEnv != "" {
env = append(env, strings.Split(*extraEnv, ",")...)
}
env = envutil.Dedup(runtime.GOOS == "windows", env)
- cmd := exec.Command(goCmd(),
+ cmd := exec.Command(goBin,
"list",
"--tags="+*tags,
"--installsuffix="+*installSuffix,
@@ -236,7 +237,7 @@
if *static {
ldflags = "-linkmode=external -extldflags '-static -pthread' " + ldflags
}
- cmd = exec.Command("go",
+ cmd = exec.Command(goBin,
"install",
"--tags="+*tags,
"--installsuffix="+*installSuffix,