func (m *RWatcher) Close() error {
	if m.isClosed {
		return nil
	}
	close(m.done)
	m.isClosed = true
	return nil
}
Close removes all watches and closes the events channel.
package rfsnotify
import (
	"gopkg.in/fsnotify.v1"
	"errors"
	"os"
	"path/filepath"
)
type RWatcher struct {
	Events chan fsnotify.Event
	Errors chan error
	done     chan struct{}
	fsnotify *fsnotify.Watcher
	isClosed bool
}
func NewWatcher() (*RWatcher, error) {
	fsWatch, err := fsnotify.NewWatcher()
	if err != nil {
		return nil, err
	}
	m := &RWatcher{}
	m.fsnotify = fsWatch
	m.Events = make(chan fsnotify.Event)
	m.Errors = make(chan error)
	m.done = make(chan struct{})
	go m.start()
	return m, nil
}
func (m *RWatcher) Add(name string) error {
	if m.isClosed {
		return errors.New("rfsnotify instance already closed")
	}
	return m.fsnotify.Add(name)
}
func (m *RWatcher) AddRecursive(name string) error {
	if m.isClosed {
		return errors.New("rfsnotify instance already closed")
	}
	if err := m.watchRecursive(name, false); err != nil {
		return err
	}
	return nil
}
func (m *RWatcher) Remove(name string) error {
	return m.fsnotify.Remove(name)
}
func (m *RWatcher) RemoveRecursive(name string) error {
	if err := m.watchRecursive(name, true); err != nil {
		return err
	}
	return nil
}