From a62540a1bcc9da3656acbe0c334e7bfe4afae703 Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Wed, 16 Nov 2022 05:17:23 +0100 Subject: [PATCH] Document that Watcher.Remove returns nil if the Watcher is closed This was already tested in TestClose/error_after_closed; just wasn't documented. --- backend_fen.go | 2 ++ backend_inotify.go | 2 ++ backend_kqueue.go | 2 ++ backend_other.go | 2 ++ backend_windows.go | 2 ++ mkdoc.zsh | 2 ++ 6 files changed, 12 insertions(+) diff --git a/backend_fen.go b/backend_fen.go index 1f4dcf7..255e533 100644 --- a/backend_fen.go +++ b/backend_fen.go @@ -270,6 +270,8 @@ func (w *Watcher) AddWith(name string, opts ...addOpt) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { if w.isClosed() { return nil diff --git a/backend_inotify.go b/backend_inotify.go index e0f9f28..2f47f4d 100644 --- a/backend_inotify.go +++ b/backend_inotify.go @@ -285,6 +285,8 @@ func (w *Watcher) AddWith(name string, opts ...addOpt) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { if w.isClosed() { return nil diff --git a/backend_kqueue.go b/backend_kqueue.go index e48225b..b83e779 100644 --- a/backend_kqueue.go +++ b/backend_kqueue.go @@ -292,6 +292,8 @@ func (w *Watcher) AddWith(name string, opts ...addOpt) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { return w.remove(name, true) } diff --git a/backend_other.go b/backend_other.go index b627170..bbf85a2 100644 --- a/backend_other.go +++ b/backend_other.go @@ -166,4 +166,6 @@ func (w *Watcher) AddWith(name string, opts ...addOpt) error { return nil } // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { return nil } diff --git a/backend_windows.go b/backend_windows.go index 86a320a..2dd9aff 100644 --- a/backend_windows.go +++ b/backend_windows.go @@ -262,6 +262,8 @@ func (w *Watcher) AddWith(name string, opts ...addOpt) error { // /tmp/dir and /tmp/dir/subdir then you will need to remove both. // // Removing a path that has not yet been added returns [ErrNonExistentWatch]. +// +// Returns nil if [Watcher.Close] was called. func (w *Watcher) Remove(name string) error { if w.isClosed() { return nil diff --git a/mkdoc.zsh b/mkdoc.zsh index 02216e7..228061e 100755 --- a/mkdoc.zsh +++ b/mkdoc.zsh @@ -120,6 +120,8 @@ remove=$(<