Skip to content
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

cmd/govim: fix darwin file system watcher event check #760

Merged
merged 1 commit into from
Feb 7, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/govim/internal/fswatcher/os_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,18 @@ func New(gomodpath string, tomb *tomb.Tomb) (*FSWatcher, error) {
for i := range events {
event := events[i]
path := filepath.Join(mountPoint, event.Path)

// Darwin might include both "created" and "changed" in the same event
// so ordering matters below. The "created" case should be checked
// before "changed" to get a behavior that is more consistent with other
// os_other.go.
switch {
case event.Flags&fRemoved > 0:
eventCh <- Event{path, OpRemoved}
case event.Flags&fChanged > 0:
eventCh <- Event{path, OpChanged}
case event.Flags&fCreated > 0:
eventCh <- Event{path, OpCreated}
case event.Flags&fChanged > 0:
eventCh <- Event{path, OpChanged}
}
}
}
Expand Down