mirror of
https://github.com/restic/restic.git
synced 2024-12-23 16:26:11 +00:00
walker: print errors
This commit is contained in:
parent
a17b6bbb64
commit
2c15597e24
1 changed files with 9 additions and 1 deletions
10
walk.go
10
walk.go
|
@ -1,6 +1,8 @@
|
||||||
package restic
|
package restic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
@ -66,6 +68,8 @@ func (tw *TreeWalker) walk(path string, tree *Tree, done chan struct{}) {
|
||||||
debug.Log("TreeWalker.walk", "start on %q", path)
|
debug.Log("TreeWalker.walk", "start on %q", path)
|
||||||
defer debug.Log("TreeWalker.walk", "done for %q", path)
|
defer debug.Log("TreeWalker.walk", "done for %q", path)
|
||||||
|
|
||||||
|
debug.Log("TreeWalker.walk", "tree %#v", tree)
|
||||||
|
|
||||||
// load all subtrees in parallel
|
// load all subtrees in parallel
|
||||||
results := make([]<-chan loadTreeResult, len(tree.Nodes))
|
results := make([]<-chan loadTreeResult, len(tree.Nodes))
|
||||||
for i, node := range 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]
|
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}
|
job = WalkTreeJob{Path: p, Tree: res.tree, Error: res.err}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue