NewFile is a standard constructor
()
| 12 | |
| 13 | // NewFile is a standard constructor |
| 14 | func NewFile() (*File, error) { |
| 15 | watcher, err := fsnotify.NewWatcher() |
| 16 | if err != nil { |
| 17 | return nil, err |
| 18 | } |
| 19 | f := &File{ |
| 20 | watcher: watcher, |
| 21 | shutdown: make(chan struct{}), |
| 22 | } |
| 23 | return f, nil |
| 24 | } |
| 25 | |
| 26 | // Add adds a file to start watching |
| 27 | func (f *File) Add(filepath string) error { |
no outgoing calls