code: func (s *Discovery) Watch(stopCh <-chan struct{}) (<-chan discovery.Entries, <-chan error) {
  	ch := make(chan discovery.Entries)
  	errCh := make(chan error)
  
  	go func() {
  		defer close(ch)
  		defer close(errCh)
  
  		// Forever: Create a store watch, watch until we get an error and then try again.
  		// Will only stop if we receive a stopCh request.
  		for {
  			// Create the path to watch if it does not exist yet
  			exists, err := s.store.Exists(s.path)
  			if err != nil {
  				errCh <- err
  			}
  			if !exists {
  				if err := s.store.Put(s.path, []byte(""), &store.WriteOptions{IsDir: true}); err != nil {
  					errCh <- err
  				}
  			}
  
  			// Set up a watch.
  			watchCh, err := s.store.WatchTree(s.path, stopCh)
  			if err != nil {
  				errCh <- err
  			} else {
  				if !s.watchOnce(stopCh, watchCh, ch, errCh) {
  					return
  				}
  			}
  
  			// If we get here it means the store watch channel was closed. This
  			// is unexpected so let's retry later.
  			errCh <- fmt.Errorf("Unexpected watch error")
  			time.Sleep(s.heartbeat)
  		}
  	}()
  	return ch, errCh
  }
docs: // Watch is exported