github.com/annwntech/go-micro/v2@v2.9.5/config/source/noop.go (about) 1 package source 2 3 import ( 4 "errors" 5 ) 6 7 type noopWatcher struct { 8 exit chan struct{} 9 } 10 11 func (w *noopWatcher) Next() (*ChangeSet, error) { 12 <-w.exit 13 14 return nil, errors.New("noopWatcher stopped") 15 } 16 17 func (w *noopWatcher) Stop() error { 18 close(w.exit) 19 return nil 20 } 21 22 // NewNoopWatcher returns a watcher that blocks on Next() until Stop() is called. 23 func NewNoopWatcher() (Watcher, error) { 24 return &noopWatcher{exit: make(chan struct{})}, nil 25 }