Skip to content

Commit

Permalink
allow overriding the number of parallel builds
Browse files Browse the repository at this point in the history
  • Loading branch information
CAFxX committed Jan 22, 2024
1 parent 03b8a08 commit c7e6169
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion main.go
Expand Up @@ -14,6 +14,7 @@ import (
"path/filepath"
"regexp"
"runtime"
"strconv"
"strings"
"sync"
"unicode"
Expand Down Expand Up @@ -124,8 +125,13 @@ func main() {
stdout := &lwriter{Writer: os.Stdout}
stderr := &lwriter{Writer: os.Stderr}

np := runtime.NumCPU()
if pbi, _ := strconv.Atoi(os.Getenv("MGO_PARALLEL_BUILD")); pbi > 0 {
np = pbi
}
sema := make(chan struct{}, np)

eg, ctx := errgroup.WithContext(context.Background())
sema := make(chan struct{}, runtime.NumCPU())
for _, v := range []string{"v1", "v2", "v3", "v4"} {
v := v
eg.Go(func() error {
Expand Down

0 comments on commit c7e6169

Please sign in to comment.