Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions cmd/ego/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"os"
"path/filepath"
"regexp"
"sync"

"github.com/benbjohnson/ego"
)
Expand Down Expand Up @@ -50,16 +51,24 @@ func main() {
}
}

var wg sync.WaitGroup

// Parse every *.ego file.
var templates []*ego.Template
for _, path := range v.paths {
t, err := ego.ParseFile(path)
if err != nil {
log.Fatal("parse file: ", err)
}
templates = append(templates, t)
wg.Add(1)
go func() {
t, err := ego.ParseFile(path)
if err != nil {
log.Fatal("parse file: ", err)
}
templates = append(templates, t)
defer wg.Done()
}()
}

wg.Wait()

// If we have no templates then exit.
if len(templates) == 0 {
os.Exit(0)
Expand Down