aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/api
diff options
context:
space:
mode:
authorBrad Fitzpatrick <bradfitz@golang.org>2014-12-22 11:16:04 -0800
committerBrad Fitzpatrick <bradfitz@golang.org>2014-12-22 19:40:32 +0000
commit45eaf500fc7ad0bd0af6087530ca59d6ba9bdd95 (patch)
treed839461b7c38c2b6b06be82d4bb9b3f4be00f5ce /src/cmd/api
parent47c7cf435705860dc143e8741616b8d6157de671 (diff)
downloadgo-45eaf500fc7ad0bd0af6087530ca59d6ba9bdd95.tar.gz
go-45eaf500fc7ad0bd0af6087530ca59d6ba9bdd95.zip
cmd/api: fix race in run.go with multiple builders on a machine
Fixes #9407 Change-Id: I765e8009c7ee22473ac8c2d81c7f6c8ec9866c51 Reviewed-on: https://go-review.googlesource.com/1980 Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'src/cmd/api')
-rw-r--r--src/cmd/api/run.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/cmd/api/run.go b/src/cmd/api/run.go
index c2c665014c..fb4cf78551 100644
--- a/src/cmd/api/run.go
+++ b/src/cmd/api/run.go
@@ -92,7 +92,12 @@ func file(s ...string) string {
// It tries to re-use a go.tools checkout from a previous run if possible,
// else it hg clones it.
func prepGoPath() string {
- const tempBase = "go.tools.TMP"
+ // Use a builder-specific temp directory name, so builders running
+ // two copies don't trample on each other: https://golang.org/issue/9407
+ // We don't use io.TempDir or a PID or timestamp here because we do
+ // want this to be stable between runs, to minimize "git clone" calls
+ // in the common case.
+ var tempBase = fmt.Sprintf("go.tools.TMP.%s.%s", runtime.GOOS, runtime.GOARCH)
username := ""
u, err := user.Current()