]> go.fuhry.dev Git - fsnotify.git/commitdiff
If statements on map results more idiomatic.
authorChris Howey <chris@howey.me>
Sat, 1 Jun 2013 21:37:11 +0000 (16:37 -0500)
committerChris Howey <chris@howey.me>
Sat, 1 Jun 2013 21:37:11 +0000 (16:37 -0500)
fsnotify_bsd.go

index a30b1ab4282730b436073d5bae07ccb515f0f1ed..bd4d9d80cc76539a0e38ee250464e5c5643f77e6 100644 (file)
@@ -385,9 +385,8 @@ func (w *Watcher) watchDirectoryFiles(dirPath string) error {
 
                // Inherit fsnFlags from parent directory
                w.fsnmut.Lock()
-               dirFsnFlags, dirFsnFound := w.fsnFlags[dirPath]
-               if dirFsnFound {
-                       w.fsnFlags[filePath] = dirFsnFlags
+               if flags, found := w.fsnFlags[dirPath]; found {
+                       w.fsnFlags[filePath] = flags
                } else {
                        w.fsnFlags[filePath] = FSN_ALL
                }
@@ -444,9 +443,8 @@ func (w *Watcher) sendDirectoryChangeEvents(dirPath string) {
                if !doesExist {
                        // Inherit fsnFlags from parent directory
                        w.fsnmut.Lock()
-                       dirFsnFlags, dirFsnFound := w.fsnFlags[dirPath]
-                       if dirFsnFound {
-                               w.fsnFlags[filePath] = dirFsnFlags
+                       if flags, found := w.fsnFlags[dirPath]; found {
+                               w.fsnFlags[filePath] = flags
                        } else {
                                w.fsnFlags[filePath] = FSN_ALL
                        }