github.com/gogf/gf@v1.16.9/.example/os/gfsnotify/gfsnotify.go (about)

     1  package main
     2  
     3  import (
     4  	"github.com/gogf/gf/os/gfsnotify"
     5  	"github.com/gogf/gf/os/glog"
     6  )
     7  
     8  func main() {
     9  	//path := `D:\temp`
    10  	path := "/Users/john/Temp"
    11  	_, err := gfsnotify.Add(path, func(event *gfsnotify.Event) {
    12  		glog.Println(event)
    13  	})
    14  	if err != nil {
    15  		glog.Fatal(err)
    16  	} else {
    17  		select {}
    18  	}
    19  }