fsnotify: use event.Has instead of "event.Op&h == h"

This commit is contained in:
Paco Xu
2022-10-13 13:42:11 +08:00
parent 3fee9d2735
commit 2ce7a81169
5 changed files with 8 additions and 15 deletions

View File

@@ -257,10 +257,7 @@ func (o *Options) initWatcher() error {
}
func (o *Options) eventHandler(ent fsnotify.Event) {
eventOpIs := func(Op fsnotify.Op) bool {
return ent.Op&Op == Op
}
if eventOpIs(fsnotify.Write) || eventOpIs(fsnotify.Rename) {
if ent.Has(fsnotify.Write) || ent.Has(fsnotify.Rename) {
// error out when ConfigFile is updated
o.errCh <- fmt.Errorf("content of the proxy server's configuration file was updated")
return