本文整理匯總了Golang中github.com/howeyc/fsnotify.Watcher.WatchFlags方法的典型用法代碼示例。如果您正苦於以下問題:Golang Watcher.WatchFlags方法的具體用法?Golang Watcher.WatchFlags怎麽用?Golang Watcher.WatchFlags使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/howeyc/fsnotify.Watcher
的用法示例。
在下文中一共展示了Watcher.WatchFlags方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: initWatchers
// initWatchers initializes the watcher flags for all the monitored directories
func initWatchers(watcher *fsnotify.Watcher, ctx Context) (err error) {
defer func() {
if e := recover(); e != nil {
err = fmt.Errorf("initWatchers() -> %v", e)
}
ctx.Channels.Log <- mig.Log{Desc: "leaving initWatchers()"}.Debug()
}()
err = watcher.WatchFlags(ctx.Directories.Action.New, fsnotify.FSN_CREATE)
if err != nil {
e := fmt.Errorf("%v '%s'", err, ctx.Directories.Action.New)
panic(e)
}
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("watcher.Watch(): %s", ctx.Directories.Action.New)}.Debug()
err = watcher.WatchFlags(ctx.Directories.Command.InFlight, fsnotify.FSN_CREATE)
if err != nil {
e := fmt.Errorf("%v '%s'", err, ctx.Directories.Command.InFlight)
panic(e)
}
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("watcher.Watch(): %s", ctx.Directories.Command.InFlight)}.Debug()
err = watcher.WatchFlags(ctx.Directories.Command.Returned, fsnotify.FSN_CREATE)
if err != nil {
e := fmt.Errorf("%v '%s'", err, ctx.Directories.Command.Returned)
panic(e)
}
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("watcher.Watch(): %s", ctx.Directories.Command.Returned)}.Debug()
err = watcher.WatchFlags(ctx.Directories.Action.Done, fsnotify.FSN_CREATE)
if err != nil {
e := fmt.Errorf("%v '%s'", err, ctx.Directories.Action.Done)
panic(e)
}
ctx.Channels.Log <- mig.Log{Desc: fmt.Sprintf("watcher.Watch(): %s", ctx.Directories.Action.Done)}.Debug()
return
}