Remove code duplication
The top-level tree is now handled by the DirWorkers
This commit is contained in:
parent
6007452fd2
commit
ab8b97c4ba
4 changed files with 114 additions and 32 deletions
12
pipe/pipe.go
12
pipe/pipe.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue