Skip to content

Instantly share code, notes, and snippets.

@zgiber
Created August 31, 2015 13:39
Show Gist options
  • Save zgiber/60aeb349559573210774 to your computer and use it in GitHub Desktop.
Save zgiber/60aeb349559573210774 to your computer and use it in GitHub Desktop.
Iterating channel
package main
import "fmt"
import "time"
func main() {
pr := make(chan interface{})
go runme(pr)
for _ = range pr {
fmt.Print(".")
}
fmt.Print("x")
}
func runme(pr chan interface{}) {
for i := 0; i < 100; i++ {
time.Sleep(10 * time.Millisecond)
pr <- nil
}
close(pr)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment