Skip to content

Instantly share code, notes, and snippets.

@orcaman
Last active July 18, 2019 09:06
Show Gist options
  • Save orcaman/0b160b8da27512bdd13be3082dd72346 to your computer and use it in GitHub Desktop.
Save orcaman/0b160b8da27512bdd13be3082dd72346 to your computer and use it in GitHub Desktop.
go func() {
wg.Wait()
donec <- true
}()
errorCount := 0
for {
select {
case err := <-errc:
if errorCount >= *maxErrors {
return err
}
case <-donec:
return nil
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment