From bd8a337728bea52e026d4314ea17043b2be3cd71 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 12 Mar 2018 01:25:44 +0900 Subject: [PATCH] docs: Generate example HTMLs in parallel --- _docs/gen.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/_docs/gen.go b/_docs/gen.go index 446081418..3026a932d 100644 --- a/_docs/gen.go +++ b/_docs/gen.go @@ -27,6 +27,7 @@ import ( "regexp" "strconv" "strings" + "sync" "github.com/hajimehoshi/ebiten/internal" ) @@ -385,12 +386,20 @@ func main() { examples = append(examples, inputExamples...) examples = append(examples, audioExamples...) examples = append(examples, gamesExamples...) + + wg := sync.WaitGroup{} for _, e := range examples { - if err := outputExampleContent(&e); err != nil { - log.Fatal(err) - } - if err := outputExample(&e); err != nil { - log.Fatal(err) - } + e := e + wg.Add(1) + go func() { + defer wg.Done() + if err := outputExampleContent(&e); err != nil { + log.Fatal(err) + } + if err := outputExample(&e); err != nil { + log.Fatal(err) + } + }() } + wg.Wait() }