Skip to content

Instantly share code, notes, and snippets.

@leonardo5621
Last active July 25, 2022 20:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leonardo5621/90ff98dc96ff69c62cb9f81eb881509f to your computer and use it in GitHub Desktop.
Save leonardo5621/90ff98dc96ff69c62cb9f81eb881509f to your computer and use it in GitHub Desktop.
func printIntegers(ctx context.Context, intStream <-chan int) {
for{
select {
case i := <-intStream:
fmt.Println(i)
case <-ctx.Done():
return
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment