Remove code duplication

The top-level tree is now handled by the DirWorkers
This commit is contained in:
Alexander Neumann 2015-03-08 20:57:21 +01:00
parent 6007452fd2
commit ab8b97c4ba
4 changed files with 114 additions and 32 deletions

View file

@ -150,7 +150,6 @@ func walk(basedir, path string, done chan struct{}, jobs chan<- Job, res chan<-
func Walk(paths []string, done chan struct{}, jobs chan<- Job, res chan<- Result) error {
defer func() {
debug.Log("pipe.Walk", "output channel closed")
close(res)
close(jobs)
}()
@ -165,7 +164,16 @@ func Walk(paths []string, done chan struct{}, jobs chan<- Job, res chan<- Result
}
debug.Log("pipe.Walk", "walker for %v done", path)
}
res <- Dir{Entries: entries}
debug.Log("pipe.Walk", "sending root node")
select {
case <-done:
return errCancelled
case jobs <- Dir{Entries: entries, result: res}:
}
debug.Log("pipe.Walk", "walker done")
return nil
}