File tree Expand file tree Collapse file tree 1 file changed +12
-6
lines changed
Expand file tree Collapse file tree 1 file changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -504,9 +504,12 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo {
504504 if err != nil {
505505 if os .IsNotExist (err ) {
506506 w .mu .Unlock ()
507- if name == err .(* os.PathError ).Path {
508- w .Error <- ErrWatchedFileDeleted
509- w .RemoveRecursive (name )
507+ pathErr , ok := err .(* os.PathError )
508+ if ok {
509+ if name == pathErr .Path {
510+ w .Error <- ErrWatchedFileDeleted
511+ w .RemoveRecursive (name )
512+ }
510513 }
511514 w .mu .Lock ()
512515 } else {
@@ -518,9 +521,12 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo {
518521 if err != nil {
519522 if os .IsNotExist (err ) {
520523 w .mu .Unlock ()
521- if name == err .(* os.PathError ).Path {
522- w .Error <- ErrWatchedFileDeleted
523- w .Remove (name )
524+ pathErr , ok := err .(* os.PathError )
525+ if ok {
526+ if name == pathErr .Path {
527+ w .Error <- ErrWatchedFileDeleted
528+ w .Remove (name )
529+ }
524530 }
525531 w .mu .Lock ()
526532 } else {
You can’t perform that action at this time.
0 commit comments