code: func waitForItemsFromChan(timeoutChan <-chan time.Time, stringChan chan string, n int, cleanupFunc func(string) error) error {
  	i := 0
  	for {
  		select {
  		case <-timeoutChan:
  			return errors.New("The prepull operation timed out")
  		case result := <-stringChan:
  			i++
  			// If the cleanup function errors; error here as well
  			if err := cleanupFunc(result); err != nil {
  				return err
  			}
  			if i == n {
  				return nil
  			}
  		}
  	}
  }
docs: // waitForItemsFromChan waits for n elements from stringChan with a timeout. For every item received from stringChan, cleanupFunc is executed