code: func (s *service) Leaders(leaders chan *Instance) (stream.Stream, error) {
  	events := make(chan *Event)
  	eventStream, err := s.client.Stream("GET", fmt.Sprintf("/services/%s/leader", s.name), nil, events)
  	if err != nil {
  		return nil, err
  	}
  	stream := stream.New()
  	go func() {
  		defer func() {
  			eventStream.Close()
  			// wait for stream to close to prevent race with Err read
  			for range events {
  			}
  			if err := eventStream.Err(); err != nil {
  				stream.Error = err
  			}
  			close(leaders)
  		}()
  		for {
  			select {
  			case event, ok := <-events:
  				if !ok {
  					return
  				}
  				if event.Kind != EventKindLeader {
  					continue
  				}
  				select {
  				case leaders <- event.Instance:
  				case <-stream.StopCh:
  					return
  				}
  			case <-stream.StopCh:
  				return
  			}
  		}
  	}()
  	return stream, nil
  }
docs: // Leaders sends leader events to the given channel (sending nil when there is
  // no leader, for example if there are no instances currently registered).