5 "github.com/fsnotify/fsnotify"
\r
10 watcher, err := fsnotify.NewWatcher()
\r
14 defer watcher.Close()
\r
16 done := make(chan bool)
\r
20 case event, ok := <-watcher.Events:
\r
21 log.Println("log event:", event)
\r
26 if event.Op & fsnotify.Create == fsnotify.Create {
\r
27 log.Println("Created " + event.Name)
\r
29 case err, ok := <-watcher.Errors:
\r
33 log.Println("error:", err)
\r
35 // fmt.Println("default")
\r
40 err = watcher.Add("/tmp/foo")
\r