Skip to content

Commit 39526e6

Browse files
committed
update noop impl.
1 parent aed7c30 commit 39526e6

File tree

1 file changed

+3
-3
lines changed
  • agent/agentcontainers/watcher

1 file changed

+3
-3
lines changed

agent/agentcontainers/watcher/noop.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"sync"
66

77
"github.com/fsnotify/fsnotify"
8-
"golang.org/x/xerrors"
98
)
109

1110
// NewNoop creates a new watcher that does nothing.
@@ -27,20 +26,21 @@ func (*noopWatcher) Remove(string) error {
2726
return nil
2827
}
2928

29+
// Next blocks until the context is canceled or the watcher is closed.
3030
func (n *noopWatcher) Next(ctx context.Context) (*fsnotify.Event, error) {
3131
select {
3232
case <-ctx.Done():
3333
return nil, ctx.Err()
3434
case <-n.done:
35-
return nil, xerrors.New("watcher closed")
35+
return nil, ErrWatcherClosed
3636
}
3737
}
3838

3939
func (n *noopWatcher) Close() error {
4040
n.mu.Lock()
4141
defer n.mu.Unlock()
4242
if n.closed {
43-
return nil
43+
return ErrWatcherClosed
4444
}
4545
n.closed = true
4646
close(n.done)

0 commit comments

Comments
 (0)