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:
James Shubin
2016-10-03 14:58:08 -04:00
parent cd26a0770d
commit b7bd2d2664

View File

@@ -158,20 +158,22 @@ func (obj *RecWatcher) Watch() error {
if global.DEBUG {
log.Printf("watcher.Add(%s): Error: %v", current, err)
}
if err == syscall.ENOENT {
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
// TODO: consider letting the user fall back to
// polling if they hit this error very often...
return fmt.Errorf("Out of inotify watches: %v", err)
} else if os.IsPermission(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)))
continue
return fmt.Errorf("Unknown error: %v", err)
}
select {