type FSWatcher … type FSEventHandler … type FSErrorHandler … type fsnotifyWatcher … var _ … // NewFsnotifyWatcher returns an implementation of FSWatcher that continuously listens for // fsnotify events and calls the event handler as soon as an event is received. func NewFsnotifyWatcher() FSWatcher { … } func (w *fsnotifyWatcher) AddWatch(path string) error { … } func (w *fsnotifyWatcher) Init(eventHandler FSEventHandler, errorHandler FSErrorHandler) error { … } func (w *fsnotifyWatcher) Run() { … } type watchAddRemover … type noopWatcher … func (noopWatcher) Add(path string) error { … } func (noopWatcher) Remove(path string) error { … } // WatchUntil watches the specified path for changes and blocks until ctx is canceled. // eventHandler() must be non-nil, and pollInterval must be greater than 0. // eventHandler() is invoked whenever a change event is observed or pollInterval elapses. // errorHandler() is invoked (if non-nil) whenever an error occurs initializing or watching the specified path. // // If path is a directory, only the directory and immediate children are watched. // // If path does not exist or cannot be watched, an error is passed to errorHandler() and eventHandler() is called at pollInterval. // // Multiple observed events may collapse to a single invocation of eventHandler(). // // eventHandler() is invoked immediately after successful initialization of the filesystem watch, // in case the path changed concurrent with calling WatchUntil(). func WatchUntil(ctx context.Context, pollInterval time.Duration, path string, eventHandler func(), errorHandler func(err error)) { … }