mirror of
https://github.com/golang/go
synced 2024-11-24 02:20:18 -07:00
cmd/go: move gc concurrency level computation near gcflags
So after constructing "args" variable, "gcflags" is not used anywhere. It makes the code easier to maintain, and prevent subtle bug like #48490. Change-Id: I41653536480880a8a6f9fbf6cfa8a461b6fb3208 Reviewed-on: https://go-review.googlesource.com/c/go/+/351849 Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
This commit is contained in:
parent
aa878ee49b
commit
9ce601df6a
@ -156,6 +156,10 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg, embedcfg
|
||||
}
|
||||
}
|
||||
}
|
||||
// Add -c=N to use concurrent backend compilation, if possible.
|
||||
if c := gcBackendConcurrency(gcflags); c > 1 {
|
||||
gcflags = append(gcflags, fmt.Sprintf("-c=%d", c))
|
||||
}
|
||||
|
||||
args := []interface{}{cfg.BuildToolexec, base.Tool("compile"), "-o", ofile, "-trimpath", a.trimpath(), defaultGcFlags, gcflags}
|
||||
if p.Internal.LocalPrefix != "" {
|
||||
@ -181,11 +185,6 @@ func (gcToolchain) gc(b *Builder, a *Action, archive string, importcfg, embedcfg
|
||||
args = append(args, "-asmhdr", objdir+"go_asm.h")
|
||||
}
|
||||
|
||||
// Add -c=N to use concurrent backend compilation, if possible.
|
||||
if c := gcBackendConcurrency(gcflags); c > 1 {
|
||||
args = append(args, fmt.Sprintf("-c=%d", c))
|
||||
}
|
||||
|
||||
for _, f := range gofiles {
|
||||
f := mkAbs(p.Dir, f)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user