code: func (m *Manager) Watch(proxyID string) (<-chan *ConfigSnapshot, CancelFunc) {
  	m.mu.Lock()
  	defer m.mu.Unlock()
  
  	// This buffering is crucial otherwise we'd block immediately trying to
  	// deliver the current snapshot below if we already have one.
  	ch := make(chan *ConfigSnapshot, 1)
  	watchers, ok := m.watchers[proxyID]
  	if !ok {
  		watchers = make(map[uint64]chan *ConfigSnapshot)
  	}
  	idx := uint64(len(watchers))
  	watchers[idx] = ch
  	m.watchers[proxyID] = watchers
  
  	// Deliver the current snapshot immediately if there is one ready
  	if state, ok := m.proxies[proxyID]; ok {
  		if snap := state.CurrentSnapshot(); snap != nil {
  			// We rely on ch being buffered above and that it's not been passed
  			// anywhere so we must be the only writer so this will never block and
  			// deadlock.
  			ch <- snap
  		}
  	}
  
  	return ch, func() {
  		m.mu.Lock()
  		defer m.mu.Unlock()
  		m.closeWatchLocked(proxyID, idx)
  	}
  }
docs: // Watch registers a watch on a proxy. It might not exist yet in which case this
  // will not fail, but no updates will be delivered until the proxy is
  // registered. If there is already a valid snapshot in memory, it will be
  // delivered immediately.