From ac600d147ec7b1afc27da3a6fc771ee98bd1ab8c Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Thu, 17 Dec 2015 12:58:28 +0900 Subject: [PATCH] WIP --- goldsmith.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/goldsmith.go b/goldsmith.go index 60e5e72..464e0a6 100644 --- a/goldsmith.go +++ b/goldsmith.go @@ -58,7 +58,7 @@ func (gs *goldsmith) queueFiles() { files := make(chan string) go scanDir(gs.srcDir, files, nil) - s := gs.makeStage() + s := gs.newStage() go func() { defer close(s.output) @@ -145,8 +145,12 @@ func (gs *goldsmith) exportFile(file *File) { } } -func (gs *goldsmith) makeStage() *stage { - s := &stage{output: make(chan *File)} +func (gs *goldsmith) newStage() *stage { + s := &stage{ + gs: gs, + output: make(chan *File), + } + if len(gs.stages) > 0 { s.input = gs.stages[len(gs.stages)-1].output } @@ -205,7 +209,7 @@ func (gs *goldsmith) refFile(path string) { } func (gs *goldsmith) Chain(p Plugin) Goldsmith { - go gs.chain(gs.makeStage(), p) + go gs.chain(gs.newStage(), p) return gs }