diff --git a/bootstrap/bootstrap.go b/bootstrap/bootstrap.go index 4f7d9165cf9689b93c595ad91c0111e48d96c449..e9a8f0111c7854eec498818968ab6f26698c12bc 100644 --- a/bootstrap/bootstrap.go +++ b/bootstrap/bootstrap.go @@ -39,7 +39,15 @@ var ( // Parallel compilation is only supported on >= go1.9 for _, r := range build.Default.ReleaseTags { if r == "go1.9" { - return fmt.Sprintf("-c %d", runtime.NumCPU()) + numCpu := runtime.NumCPU() + // This will cause us to recompile all go programs if the + // number of cpus changes. We don't get a lot of benefit from + // higher values, so cap this to make it cheaper to move trees + // between machines. + if numCpu > 8 { + numCpu = 8 + } + return fmt.Sprintf("-c %d", numCpu) } } return ""