本文整理汇总了Golang中gopkg/in/fsnotify/v1.Watcher.Remove方法的典型用法代码示例。如果您正苦于以下问题:Golang Watcher.Remove方法的具体用法?Golang Watcher.Remove怎么用?Golang Watcher.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gopkg/in/fsnotify/v1.Watcher
的用法示例。
在下文中一共展示了Watcher.Remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: handleChange
func handleChange(event fsnotify.Event,
db *SymbolsDB,
watcher *fsnotify.Watcher,
files chan string) {
visitorDir := func(path string) {
// add watcher to directory
watcher.Add(path)
}
visitorC := func(path string) {
// add watcher
watcher.Add(path)
// put file in channel
files <- path
}
switch {
case event.Op&(fsnotify.Write|fsnotify.Create|fsnotify.Chmod) != 0:
traversePath(event.Name, visitorDir, visitorC)
case event.Op&(fsnotify.Remove|fsnotify.Rename) != 0:
watcher.Remove(event.Name)
tx := db.BeginTx()
tx.RemoveFileReferences(filepath.Clean(event.Name))
tx.Close()
}
}
示例2: removeWatcherOn
func (s *SpecInfoGatherer) removeWatcherOn(watcher *fsnotify.Watcher, path string) {
logger.APILog.Info("Removing watcher on : %s", path)
watcher.Remove(path)
}
示例3: removeWatcherOn
func (specInfoGatherer *specInfoGatherer) removeWatcherOn(watcher *fsnotify.Watcher, path string) {
logger.ApiLog.Error("Removing watcher on : %s", path)
watcher.Remove(path)
}