1
0
mirror of https://github.com/golang/go synced 2024-09-24 21:10:12 -06:00

cmd/go: fix data race on buildLdflags

Fixes #7438.

LGTM=rsc
R=golang-codereviews
CC=bradfitz, golang-codereviews, iant, rsc
https://golang.org/cl/70420044
This commit is contained in:
Dmitriy Vyukov 2014-03-04 11:42:02 +04:00
parent 52e6d7c622
commit d1c6c6004b

View File

@ -1714,6 +1714,8 @@ func (gcToolchain) ld(b *builder, p *Package, out string, allactions []*action,
}
}
ldflags := buildLdflags
// Limit slice capacity so that concurrent appends do not race on the shared array.
ldflags = ldflags[:len(ldflags):len(ldflags)]
if buildContext.InstallSuffix != "" {
ldflags = append(ldflags, "-installsuffix", buildContext.InstallSuffix)
}