Use the correct channel for sending errors

This commit is contained in:
Alexander Neumann 2015-10-11 19:13:45 +02:00
parent 86c8328f62
commit db85ab8aa0
2 changed files with 9 additions and 3 deletions

View File

@ -505,13 +505,12 @@ func (c *Checker) Structure(errChan chan<- error, done <-chan struct{}) {
treeIDChan := make(chan backend.ID)
treeJobChan1 := make(chan treeJob)
treeJobChan2 := make(chan treeJob)
treeErrChan := make(chan TreeError)
var wg sync.WaitGroup
for i := 0; i < defaultParallelism; i++ {
wg.Add(2)
go loadTreeWorker(c.repo, treeIDChan, treeJobChan1, done, &wg)
go c.checkTreeWorker(treeJobChan2, treeErrChan, done, &wg)
go c.checkTreeWorker(treeJobChan2, errChan, done, &wg)
}
filterTrees(trees, treeIDChan, treeJobChan1, treeJobChan2, done)

View File

@ -79,7 +79,14 @@ func (cmd CmdCheck) Execute(args []string) error {
for err := range errChan {
errorsFound = true
fmt.Fprintf(os.Stderr, "error: %v\n", err)
if e, ok := err.(checker.TreeError); ok {
fmt.Fprintf(os.Stderr, "error for tree %v:\n", e.ID.Str())
for _, treeErr := range e.Errors {
fmt.Fprintf(os.Stderr, " %v\n", treeErr)
}
} else {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
}
}
for _, id := range chkr.UnusedBlobs() {