diff --git a/internal/aghnet/hostscontainer.go b/internal/aghnet/hostscontainer.go index b8e8644823e..9390ac45535 100644 --- a/internal/aghnet/hostscontainer.go +++ b/internal/aghnet/hostscontainer.go @@ -161,7 +161,8 @@ func (hc *HostsContainer) handleEvents() { defer close(hc.updates) - ok, eventsCh := true, hc.watcher.Events() + eventsCh := hc.watcher.Events() + ok := eventsCh != nil for ok { select { case _, ok = <-eventsCh: diff --git a/internal/aghos/fswatcher.go b/internal/aghos/fswatcher.go index 5cb1b1c5800..de95e94c4cd 100644 --- a/internal/aghos/fswatcher.go +++ b/internal/aghos/fswatcher.go @@ -168,22 +168,26 @@ type EmptyFSWatcher struct{} // type check var _ FSWatcher = EmptyFSWatcher{} -// Start implements the [FSWatcher] interface for EmptyFSWatcher. +// Start implements the [FSWatcher] interface for EmptyFSWatcher. It always +// returns nil error. func (EmptyFSWatcher) Start() (err error) { return nil } -// Close implements the [FSWatcher] interface for EmptyFSWatcher. +// Close implements the [FSWatcher] interface for EmptyFSWatcher. It always +// returns nil error. func (EmptyFSWatcher) Close() (err error) { return nil } -// Events implements the [FSWatcher] interface for EmptyFSWatcher. +// Events implements the [FSWatcher] interface for EmptyFSWatcher. It always +// returns nil channel. func (EmptyFSWatcher) Events() (e <-chan event) { return nil } -// Add implements the [FSWatcher] interface for EmptyFSWatcher. +// Add implements the [FSWatcher] interface for EmptyFSWatcher. It always +// returns nil error. func (EmptyFSWatcher) Add(_ string) (err error) { return nil }