Commit 45eaf500 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

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/1980Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
parent 47c7cf43
...@@ -92,7 +92,12 @@ func file(s ...string) string { ...@@ -92,7 +92,12 @@ func file(s ...string) string {
// It tries to re-use a go.tools checkout from a previous run if possible, // It tries to re-use a go.tools checkout from a previous run if possible,
// else it hg clones it. // else it hg clones it.
func prepGoPath() string { 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 := "" username := ""
u, err := user.Current() u, err := user.Current()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment