This commit is contained in:
Alex Yatskov 2021-04-25 09:29:53 -07:00
parent 3155de7542
commit 14c9c2065f
2 changed files with 10 additions and 0 deletions

View File

@ -84,14 +84,20 @@ func (goldsmith *Goldsmith) FilterPop() *Goldsmith {
func (goldsmith *Goldsmith) End(targetDir string) []error {
goldsmith.targetDir = targetDir
var wg sync.WaitGroup
goldsmith.Chain(&saver{
clean: goldsmith.clean,
wg: &wg,
})
wg.Add(1)
for _, context := range goldsmith.contexts {
go context.step()
}
wg.Wait()
return goldsmith.errors
}

View File

@ -3,11 +3,13 @@ package goldsmith
import (
"os"
"path/filepath"
"sync"
)
type saver struct {
clean bool
tokens map[string]bool
wg *sync.WaitGroup
}
func (*saver) Name() string {
@ -29,6 +31,8 @@ func (saver *saver) Process(context *Context, file *File) error {
}
func (saver *saver) Finalize(context *Context) error {
defer saver.wg.Done()
if !saver.clean {
return nil
}