1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-02-09 13:36:56 +02:00

Reduce the number of concurrent builds

With many GOOS OARCH combos, the CPU is glowing.
This commit is contained in:
Bjørn Erik Pedersen 2017-04-21 14:40:25 +02:00
parent 880b2c22ed
commit 6db75f7ca9

View File

@ -28,9 +28,11 @@ func (Pipe) Run(ctx *context.Context) error {
if err := runHook(ctx.Config.Build.Hooks.Pre); err != nil {
return err
}
sem := make(chan bool, 4)
var g errgroup.Group
for _, goos := range ctx.Config.Build.Goos {
for _, goarch := range ctx.Config.Build.Goarch {
sem <- true
goos := goos
goarch := goarch
if !valid(goos, goarch) {
@ -42,6 +44,9 @@ func (Pipe) Run(ctx *context.Context) error {
}
ctx.Archives[goos+goarch] = name
g.Go(func() error {
defer func() {
<-sem
}()
return build(name, goos, goarch, ctx)
})
}