func (w *Watcher) Watch() error {
	if w.opts.PartialMap == nil {
		w.opts.PartialMap = NewPartialMap()
	}
	if len(w.opts.Paths) == 0 {
		return errors.New("No paths to watch")
	}
	err := w.watchFiles()
	if err != nil {
		return err
	}
	w.closed = make(chan struct{})
	go w.startWatching()
	return nil
}
Watch is the main entry point into filewatcher and sets up the
SW object that begins monitoring for file changes and triggering
top level sass rebuilds.
package wellington
import (
	"errors"
	"log"
	"os"
	"path/filepath"
	"sync"
)
const MaxTopLevel int = 20
type WatchOptions struct {
	PartialMap *SafePartialMap
	Paths      []string
	BArgs      *BuildArgs
}
func NewWatchOptions() *WatchOptions {
	return &WatchOptions{
		PartialMap: NewPartialMap(),
	}
}
func NewWatcher(opts *WatchOptions) (*Watcher, error) {
	if opts == nil {
		opts = &WatchOptions{}
	}
	w := &Watcher{
		opts:    opts,
		errChan: make(chan error),
	}
	w.Init()
	go func() {
		for {
			select {
			case err := <-w.errChan:
				log.Println("watcher: build error:", err)
			}
		}
	}()
	return w, nil
}
type SafePartialMap struct {
	sync.RWMutex
	M map[string][]string
}
func NewPartialMap() *SafePartialMap {
	spm := &SafePartialMap{
		M: make(map[string][]string, 100)}
	return spm
}
func (p *SafePartialMap) Add(key string, paths []string) {
	p.Lock()
	defer p.Unlock()
	p.M[key] = paths
}
func (p *SafePartialMap) Get(key string) ([]string, bool) {
	p.RLock()
	pm, ok := p.M[key]
	p.RUnlock()
	return pm, ok
}
func (p *SafePartialMap) AddRelation(mainfile string, subfile string) {
	existing, _ := p.Get(subfile)
	p.Add(subfile, appendUnique(existing, mainfile))
}
var watcherChanMu sync.RWMutex
var watcherChan chan string