recwatch: Rearrange condition to unconfuse golinter
This wasn't a bug, but the go linter is unhappy because it is dumb.
This commit is contained in:
@@ -158,20 +158,22 @@ func (obj *RecWatcher) Watch() error {
|
|||||||
if global.DEBUG {
|
if global.DEBUG {
|
||||||
log.Printf("watcher.Add(%s): Error: %v", current, err)
|
log.Printf("watcher.Add(%s): Error: %v", current, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == syscall.ENOENT {
|
if err == syscall.ENOENT {
|
||||||
index-- // usually not found, move up one dir
|
index-- // usually not found, move up one dir
|
||||||
} else if err == syscall.ENOSPC {
|
index = int(math.Max(1, float64(index)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == syscall.ENOSPC {
|
||||||
// no space left on device, out of inotify watches
|
// no space left on device, out of inotify watches
|
||||||
// TODO: consider letting the user fall back to
|
// TODO: consider letting the user fall back to
|
||||||
// polling if they hit this error very often...
|
// polling if they hit this error very often...
|
||||||
return fmt.Errorf("Out of inotify watches: %v", err)
|
return fmt.Errorf("Out of inotify watches: %v", err)
|
||||||
} else if os.IsPermission(err) {
|
} else if os.IsPermission(err) {
|
||||||
return fmt.Errorf("Permission denied adding a watch: %v", err)
|
return fmt.Errorf("Permission denied adding a watch: %v", err)
|
||||||
} else {
|
|
||||||
return fmt.Errorf("Unknown error: %v", err)
|
|
||||||
}
|
}
|
||||||
index = int(math.Max(1, float64(index)))
|
return fmt.Errorf("Unknown error: %v", err)
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
|||||||
Reference in New Issue
Block a user