a complete example?
saggit opened this issue · 1 comments
saggit commented
i put the example code in main,but it seems does not work.here is my code
env: win7 golang1.1
package main
import (
"log"
"github.com/howeyc/fsnotify"
)
func main(){
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
go func() {
for {
select {
case ev := <-watcher.Event:
log.Println("event:", ev)
case err := <-watcher.Error:
log.Println("error:", err)
}
}
}()
err = watcher.Watch("E:/mysite/golang_code/cmd")
if err != nil {
log.Fatal(err)
}
}
when i run go run xx.go ,the program run and exit,nothing happended!,any idea?
saggit commented
i get help from this https://gist.github.com/howeyc/4762676