Merge pull request #1393 from armhold/lint-errcheck

detect errors from fs.Walk() in local backend List()
This commit is contained in:
Alexander Neumann 2017-10-28 09:56:11 +02:00
commit 7a99418dc5

View file

@ -252,23 +252,27 @@ func (b *Local) List(ctx context.Context, t restic.FileType) <-chan string {
go func() { go func() {
defer close(ch) defer close(ch)
fs.Walk(b.Basedir(t), func(path string, fi os.FileInfo, err error) error { err := fs.Walk(b.Basedir(t), func(path string, fi os.FileInfo, err error) error {
if err != nil { if err != nil {
return err return err
} }
if !isFile(fi) { if !isFile(fi) {
return err return nil
} }
select { select {
case ch <- filepath.Base(path): case ch <- filepath.Base(path):
case <-ctx.Done(): case <-ctx.Done():
return err return nil
} }
return err return nil
}) })
if err != nil {
debug.Log("Walk %v", err)
}
}() }()
return ch return ch