// IsRename reports whether the FileEvent was triggered by a change name
func (e *FileEvent) IsRename() bool { return (e.mask & sys_NOTE_RENAME) == sys_NOTE_RENAME }
-// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata (eg.
-// atime, mtime etc.)
+// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata.
func (e *FileEvent) IsAttrib() bool {
return (e.mask & sys_NOTE_ATTRIB) == sys_NOTE_ATTRIB
}
// Find all watched paths that are in this directory that are not external.
if fInfo.IsDir() {
- pathsToRemove := make([]string, 0)
+ var pathsToRemove []string
w.pmut.Lock()
for _, wpath := range w.paths {
wdir, _ := filepath.Split(wpath)
if filepath.Clean(wdir) == filepath.Clean(path) {
w.ewmut.Lock()
- if _, extern := w.externalWatches[wpath]; !extern {
+ if !w.externalWatches[wpath] {
pathsToRemove = append(pathsToRemove, wpath)
}
w.ewmut.Unlock()
}
}
w.pmut.Unlock()
- for idx := 0; idx < len(pathsToRemove); idx++ {
+ for _, p := range pathsToRemove {
// Since these are internal, not much sense in propagating error
// to the user, as that will just confuse them with an error about
// a path they did not explicitly watch themselves.
- w.removeWatch(pathsToRemove[idx])
+ w.removeWatch(p)
}
}
return ((e.mask&sys_IN_MOVE_SELF) == sys_IN_MOVE_SELF || (e.mask&sys_IN_MOVED_FROM) == sys_IN_MOVED_FROM)
}
-// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata (eg.
-// atime, mtime etc.)
+// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata.
func (e *FileEvent) IsAttrib() bool {
return (e.mask & sys_IN_ATTRIB) == sys_IN_ATTRIB
}
default:
}
- n, errno = syscall.Read(w.fd, buf[0:])
+ n, errno = syscall.Read(w.fd, buf[:])
// If EOF is received
if n == 0 {
return ((e.mask&sys_FS_MOVE) == sys_FS_MOVE || (e.mask&sys_FS_MOVE_SELF) == sys_FS_MOVE_SELF || (e.mask&sys_FS_MOVED_FROM) == sys_FS_MOVED_FROM || (e.mask&sys_FS_MOVED_TO) == sys_FS_MOVED_TO)
}
-// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata (eg.
-// atime, mtime etc.)
+// IsAttrib reports whether the FileEvent was triggered by a change in the file metadata.
func (e *FileEvent) IsAttrib() bool {
return (e.mask & sys_FS_ATTRIB) == sys_FS_ATTRIB
}
select {
case ch := <-w.quit:
w.mu.Lock()
- indexes := make([]indexMap, 0)
+ var indexes []indexMap
for _, index := range w.watches {
indexes = append(indexes, index)
}
if watch == nil {
w.Error <- errors.New("ERROR_MORE_DATA has unexpectedly null lpOverlapped buffer")
} else {
- //The i/o succeeded but buffer is full
- //in theory we should be building up a full packet
- //in practice we can get away with just carrying on
+ // The i/o succeeded but the buffer is full.
+ // In theory we should be building up a full packet.
+ // In practice we can get away with just carrying on.
n = uint32(unsafe.Sizeof(watch.buf))
}
case syscall.ERROR_ACCESS_DENIED: