diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go index 6c9b9f7e503..bf30be70e4d 100644 --- a/src/cmd/go/build.go +++ b/src/cmd/go/build.go @@ -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) }