]> go.fuhry.dev Git - fsnotify.git/commit
Add {Event,Op}.Has() (#477)
authorMartin Tournoij <martin@arp242.net>
Sat, 30 Jul 2022 15:28:03 +0000 (17:28 +0200)
committerGitHub <noreply@github.com>
Sat, 30 Jul 2022 15:28:03 +0000 (17:28 +0200)
commit57e6a492ad52980fc388256312c67e5b810a6e6f
tree437c2079dfaf65b1254ea9c15ccb38a1969bbce0
parent39823aacae1b98c318c2c9b2483b1aa423e85475
Add {Event,Op}.Has() (#477)

Using:

if event.Op&fsnotify.Create == fsnotify.Create {
}

is overly verbose and awkward; a Has() method makes this much nicer:

if event.Has(fsnotify.Create) {
}

PR #76 was previously rejected; I think that HasCreate() etc. is
overkill, but a Has() method makes the library quite a bit more
convenient IMO.

I added it to both the Event and Op to avoid confusion; with this we can
change the Op field to be private in a future v2.

Fixes #107
README.md
cmd/fsnotify/main.go
fsnotify.go