Browse Source

Do not abort scan when encountering a file not found error

master v0.1.3
Trevor Slocum 3 years ago
parent
commit
349e30c974
  1. 3
      CHANGELOG
  2. 14
      scan.go

3
CHANGELOG

@ -1,3 +1,6 @@
0.1.3:
- Do not abort scan when encountering a file not found error
0.1.2:
- Reuse buffer when scanning

14
scan.go

@ -88,7 +88,10 @@ func scanFunc(i int, s *scan) filepath.WalkFunc {
s.Add(1)
go func() {
if err != nil {
if os.IsNotExist(err) {
s.Done()
return
} else if err != nil {
s.errs <- err
s.Done()
return
@ -100,7 +103,10 @@ func scanFunc(i int, s *scan) filepath.WalkFunc {
}
f, err := os.OpenFile(path, os.O_RDONLY, 0644)
if err != nil {
if os.IsNotExist(err) {
s.Done()
return
} else if err != nil {
s.errs <- err
s.Done()
return
@ -117,7 +123,9 @@ func scanDir(i int, dir string, s *scan) {
defer s.Done()
err := filepath.Walk(dir, scanFunc(i, s))
if err != nil {
if os.IsNotExist(err) {
return
} else if err != nil {
s.errs <- err
}
}

Loading…
Cancel
Save