walker: print errors

This commit is contained in:
Alexander Neumann 2015-12-29 00:26:29 +01:00
parent a17b6bbb64
commit 2c15597e24

10
walk.go
View file

@ -1,6 +1,8 @@
package restic
import (
"fmt"
"os"
"path/filepath"
"sync"
@ -66,6 +68,8 @@ func (tw *TreeWalker) walk(path string, tree *Tree, done chan struct{}) {
debug.Log("TreeWalker.walk", "start on %q", path)
defer debug.Log("TreeWalker.walk", "done for %q", path)
debug.Log("TreeWalker.walk", "tree %#v", tree)
// load all subtrees in parallel
results := make([]<-chan loadTreeResult, len(tree.Nodes))
for i, node := range tree.Nodes {
@ -90,7 +94,11 @@ func (tw *TreeWalker) walk(path string, tree *Tree, done chan struct{}) {
}
res := <-results[i]
tw.walk(p, res.tree, done)
if res.err == nil {
tw.walk(p, res.tree, done)
} else {
fmt.Fprintf(os.Stderr, "error loading tree: %v\n", res.err)
}
job = WalkTreeJob{Path: p, Tree: res.tree, Error: res.err}
} else {