From 0587510d194a78ea17d7c9d1f2447241c6f86b80 Mon Sep 17 00:00:00 2001 From: Jonathan Rudenberg Date: Thu, 25 Dec 2014 20:59:31 -0500 Subject: [PATCH] Remove Close method from FileChanges This method will never do what we want, closing the channels will always signal receivers, which will confuse them. --- watch/filechanges.go | 6 ------ watch/inotify.go | 1 - watch/polling.go | 2 -- 3 files changed, 9 deletions(-) diff --git a/watch/filechanges.go b/watch/filechanges.go index fb0f9ef..3ce5dce 100644 --- a/watch/filechanges.go +++ b/watch/filechanges.go @@ -23,12 +23,6 @@ func (fc *FileChanges) NotifyDeleted() { sendOnlyIfEmpty(fc.Deleted) } -func (fc *FileChanges) Close() { - close(fc.Modified) - close(fc.Truncated) - close(fc.Deleted) -} - // sendOnlyIfEmpty sends on a bool channel only if the channel has no // backlog to be read by other goroutines. This concurrency pattern // can be used to notify other goroutines if and only if they are diff --git a/watch/inotify.go b/watch/inotify.go index c2f13dc..0b1b1fe 100644 --- a/watch/inotify.go +++ b/watch/inotify.go @@ -77,7 +77,6 @@ func (fw *InotifyFileWatcher) ChangeEvents(t *tomb.Tomb, fi os.FileInfo) *FileCh go func() { defer inotifyTracker.CloseWatcher(w) - defer changes.Close() for { prevSize := fw.Size diff --git a/watch/polling.go b/watch/polling.go index 10a17eb..de01c71 100644 --- a/watch/polling.go +++ b/watch/polling.go @@ -49,8 +49,6 @@ func (fw *PollingFileWatcher) ChangeEvents(t *tomb.Tomb, origFi os.FileInfo) *Fi fw.Size = origFi.Size() go func() { - defer changes.Close() - var retry int = 0 prevSize := fw.Size