1
0
mirror of https://github.com/golang/go synced 2024-11-21 23:34:42 -07:00

cmd/go: fix data race during build

Fixes #2695.

R=golang-dev, mpimenov, minux.ma, rsc
CC=golang-dev
https://golang.org/cl/5545052
This commit is contained in:
Dmitriy Vyukov 2012-01-13 22:22:03 +04:00
parent c7cdce13f5
commit a4f7024e0a

View File

@ -873,6 +873,8 @@ func (b *builder) runOut(dir string, desc string, cmdargs ...interface{}) ([]byt
// mkdir makes the named directory. // mkdir makes the named directory.
func (b *builder) mkdir(dir string) error { func (b *builder) mkdir(dir string) error {
b.exec.Lock()
defer b.exec.Unlock()
// We can be a little aggressive about being // We can be a little aggressive about being
// sure directories exist. Skip repeated calls. // sure directories exist. Skip repeated calls.
if b.mkdirCache[dir] { if b.mkdirCache[dir] {