gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/registry/memory/memory_watcher.go (about) 1 package memory 2 3 import ( 4 "errors" 5 6 "gitee.com/liuxuezhan/go-micro-v1.18.0/registry" 7 ) 8 9 type memoryWatcher struct { 10 exit chan bool 11 opts registry.WatchOptions 12 } 13 14 func (m *memoryWatcher) Next() (*registry.Result, error) { 15 // not implement so we just block until exit 16 <-m.exit 17 return nil, errors.New("watcher stopped") 18 } 19 20 func (m *memoryWatcher) Stop() { 21 select { 22 case <-m.exit: 23 return 24 default: 25 close(m.exit) 26 } 27 }