Compare commits

2 Commits

Author SHA1 Message Date
8524870171 with readme 2022-12-29 02:54:39 +01:00
6403f26cd7 with capture 2022-10-30 15:46:52 +01:00
2 changed files with 16 additions and 3 deletions

9
README.md Normal file
View File

@@ -0,0 +1,9 @@
# Byg
`Byg` (Danish for `build`), is a data-structure designed for a composing
pipelines, it is in a very rough state, and changes according to the needs to
`kjuulh/bust`
## Examples
See `examples` for example pipelines.

10
byg.go
View File

@@ -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 {