Skip to content

Instantly share code, notes, and snippets.

@Cergoo
Created December 1, 2013 11:35
Show Gist options
  • Save Cergoo/7732471 to your computer and use it in GitHub Desktop.
Save Cergoo/7732471 to your computer and use it in GitHub Desktop.
for x := range container.Iter() { ...
func (c *container) Iter () <-chan item {
ch := make(chan item);
go func () {
for i := 0; i < c.size; i++ {
ch <- c.items[i]
}
} ();
return ch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment