1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
12 "github.com/fsnotify/fsnotify"
15 func ExampleNewWatcher() {
16 watcher, err := fsnotify.NewWatcher()
22 done := make(chan bool)
26 case event := <-watcher.Events:
27 log.Println("event:", event)
28 if event.Op&fsnotify.Write == fsnotify.Write {
29 log.Println("modified file:", event.Name)
31 case err := <-watcher.Errors:
32 log.Println("error:", err)
37 err = watcher.Add("/tmp/foo")