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 a249aed251
commit 1dead8c821

View file

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