(ctx context.Context)
| 82 | var mx gsync.Mutex |
| 83 | |
| 84 | func (w *Watcher) Start(ctx context.Context) error { |
| 85 | mx.Lock() |
| 86 | defer mx.Unlock() |
| 87 | ctx, cancelFunc := context.WithCancel(ctx) |
| 88 | w.stopFn = cancelFunc |
| 89 | wait, err := w.watchFn(ctx, w.project, w.options) |
| 90 | if err != nil { |
| 91 | go func() { |
| 92 | w.errCh <- err |
| 93 | }() |
| 94 | return err |
| 95 | } |
| 96 | go func() { |
| 97 | w.errCh <- wait() |
| 98 | }() |
| 99 | return nil |
| 100 | } |
| 101 | |
| 102 | func (w *Watcher) Stop() error { |
| 103 | mx.Lock() |