From 593985fd41e2ffdd9bed37e887f624175274abf6 Mon Sep 17 00:00:00 2001 From: Guillaume Legros Date: Mon, 14 Jan 2019 22:17:38 +0100 Subject: [PATCH] fixed removing parent path when encountering an error --- watcher.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/watcher.go b/watcher.go index e353296..effac1d 100644 --- a/watcher.go +++ b/watcher.go @@ -497,7 +497,7 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo { if os.IsNotExist(err) { w.Error <- ErrWatchedFileDeleted w.mu.Unlock() - w.RemoveRecursive(name) + w.RemoveRecursive(err.(*os.PathError).Path) w.mu.Lock() } else { w.Error <- err @@ -509,7 +509,7 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo { if os.IsNotExist(err) { w.Error <- ErrWatchedFileDeleted w.mu.Unlock() - w.Remove(name) + w.Remove(err.(*os.PathError).Path) w.mu.Lock() } else { w.Error <- err