func (p *Pipeline) gather(
	wg *sync.WaitGroup,
	eventChan chan<- PipelineEvent,
	object string,
	output chan<- provider.GitRepository,
	limit int) {
	defer wg.Done()
	defer close(output)

	repositories, err := p.Provider.Gather(object)
	if err != nil {
		log.Errorf("Gathering repositories failed: %v\n", err)

		return
	}

	p.publishEvent(eventChan, RepositoryListPipelineEvent{repositories})

	collected := 0
	ignored := 0

	for index, repository := range repositories {
		if limit > 0 && index >= limit {
			ignored++
		} else {
			collected++
			output <- repository
		}
	}

	if ignored > 0 {
		log.Warnln("Limit reached for number of repositories")
		log.Warnf("Collected %d repos, ignored %d repos.", collected, ignored)
	}

	log.Infoln("Done gathering repositories")
}
// run in its own goroutine.
run in its own goroutine.
// run in its own goroutine .
func (p *Pipeline) gather(
	wg *sync.WaitGroup,
	eventChan chan<- PipelineEvent,
	object string,
	output chan<- provider.GitRepository,
	limit int) {
	defer wg.Done()
	defer close(output)
	repositories, err := p.Provider.Gather(object)
	if err != nil {
		log.Errorf("Gathering repositories failed: %v\n", err)
		return
	}
	p.publishEvent(eventChan, RepositoryListPipelineEvent{repositories})
	collected := 0
	ignored := 0
	for index, repository := range repositories {
		if limit > 0 && index >= limit {
			ignored++
		} else {
			collected++
			output <- repository
		}
	}
	if ignored > 0 {
		log.Warnln("Limit reached for number of repositories")
		log.Warnf("Collected %d repos, ignored %d repos.", collected, ignored)
	}
	log.Infoln("Done gathering repositories")
}
func ( p * Pipeline ) gather ( wg * sync . WaitGroup , eventChan chan <- PipelineEvent , object string , output chan <- provider . GitRepository , limit int ) { defer wg . Done ( ) defer close ( output ) repositories , err := p . Provider . Gather ( object ) if err != nil { log . Errorf ( " \n " , err ) return } p . publishEvent ( eventChan , RepositoryListPipelineEvent { repositories } ) collected := 0 ignored := 0 for index , repository := range repositories { if limit > 0 && index >= limit { ignored ++ } else { collected ++ output <- repository } } if ignored > 0 { log . Warnln ( " " ) log . Warnf ( " " , collected , ignored ) } log . Infoln ( " " ) }
run in its own goroutine.
run in its own goroutine .