Skip over when not exist

This commit is contained in:
Dane Everitt 2020-07-18 10:54:37 -07:00
parent 7c3da84248
commit 6e1844a8c9
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -63,6 +63,12 @@ func (w *PooledFileWalker) process(path string) error {
sp := filepath.Join(p, f.Name()) sp := filepath.Join(p, f.Name())
i, err := os.Stat(sp) i, err := os.Stat(sp)
// You might end up getting an error about a file or folder not existing if the given path
// if it is an invalid symlink. We can safely just skip over these files I believe.
if os.IsNotExist(err) {
continue
}
// Call the user-provided callback for this file or directory. If an error is returned that is // Call the user-provided callback for this file or directory. If an error is returned that is
// not a SkipDir call, abort the entire process and bubble that error up. // not a SkipDir call, abort the entire process and bubble that error up.
if err = w.callback(sp, i, err); err != nil && err != filepath.SkipDir { if err = w.callback(sp, i, err); err != nil && err != filepath.SkipDir {