with capture
This commit is contained in:
parent
81bf4841b8
commit
6403f26cd7
10
byg.go
10
byg.go
@ -2,6 +2,7 @@ package byg
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"log"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
@ -52,12 +53,15 @@ func (bb *Builder) Execute(ctx context.Context) error {
|
|||||||
defer bb.addmu.Unlock()
|
defer bb.addmu.Unlock()
|
||||||
|
|
||||||
for _, step := range bb.steps {
|
for _, step := range bb.steps {
|
||||||
|
log.Printf("executing step: %s", step.name)
|
||||||
errgroup, _ := errgroup.WithContext(ctx)
|
errgroup, _ := errgroup.WithContext(ctx)
|
||||||
|
|
||||||
for _, task := range step.tasks {
|
for _, task := range step.tasks {
|
||||||
errgroup.Go(func() error {
|
func(task StepExecuteFunc) {
|
||||||
return task(Context{})
|
errgroup.Go(func() error {
|
||||||
})
|
return task(Context{})
|
||||||
|
})
|
||||||
|
}(task)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := errgroup.Wait(); err != nil {
|
if err := errgroup.Wait(); err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user