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

Merge pull request #189 from bep/limit-concurrency

Reduce the number of concurrent builds
This commit is contained in:
Carlos Alexandro Becker 2017-04-21 11:36:33 -03:00 committed by GitHub
commit 7b5ae4b54c

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)
})
}