New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error when stopping watching a non watched file #455
Conversation
Currently, when a non-watched item is requested to be removed from a watch, an error is returned. However, the post-condition of removing it is: "This file/dir should not be watched anymore", which is the case also when the item wasn't being watched in the first place. Rather than returning an error. Return nil and skip a part of the work.
If this Remove function returns a wrapped error for |
That could also be a possibility. I'm not that experienced in go so I don't know what would be the most idiomatic way. |
I prefer to add
and return it in inotify.go, kqueue.go, windows.go
any thought? @nathany @shogo82148 |
@mattn a new error sounds good to me |
The errors returned by the various implementations of the watcher are all different which makes handling them difficult. This PR follows the suggestion in: #455 (comment) by @mattn to create a common error which is wrapped by the implementations. Replaces: #455 Signed-off-by: Andrew Thornton <art27@cantab.net>
I agree that outright removing the error is not a good solution; I opened #460 to return a specific error that can be tested for, which should address the issue better. |
The errors returned by the various implementations of the watcher are all different which makes handling them difficult. This PR follows the suggestion in: #455 (comment) by @mattn to create a common error which is wrapped by the implementations. Replaces: #455 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Andrew Thornton <art27@cantab.net>
port of fsnotify/fsnotify#460 The errors returned by the various implementations of the watcher are all different which makes handling them difficult. This PR follows the suggestion in: fsnotify/fsnotify#455 (comment) by @mattn to create a common error which is wrapped by the implementations.
What does this pull request do?
Currently, when a non-watched item is requested to be removed from a
watch, an error is returned.
However, the post-condition of removing it is: "This file/dir should not
be watched anymore", which is the case also when the item wasn't being
watched in the first place.
Rather than returning an error. Return nil and skip a part of the work.
Where should the reviewer start?
inotify.go, the Remove function definition.
How should this be manually tested?
We've noticed this because this lib is being used in promtail and it was logging errors because of this.