code clean for fsnotify (#9571)

Signed-off-by: yanggang <gang.yang@daocloud.io>
This commit is contained in:
杨刚 (成都) 2023-02-16 22:11:39 +08:00 committed by GitHub
parent 57398dee16
commit 080c905fab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,8 +72,8 @@ func (f *OSFileWatcher) watch() error {
for { for {
select { select {
case event := <-watcher.Events: case event := <-watcher.Events:
if event.Op&fsnotify.Create == fsnotify.Create || if event.Has(fsnotify.Create) ||
event.Op&fsnotify.Write == fsnotify.Write { event.Has(fsnotify.Write) {
if finfo, err := os.Lstat(event.Name); err != nil { if finfo, err := os.Lstat(event.Name); err != nil {
log.Printf("can not lstat file: %v\n", err) log.Printf("can not lstat file: %v\n", err)
} else if finfo.Mode()&os.ModeSymlink != 0 { } else if finfo.Mode()&os.ModeSymlink != 0 {