Skip to content

Instantly share code, notes, and snippets.

@eriknelson
Created September 29, 2017 00:40
Show Gist options
  • Save eriknelson/2c27f8006ee0008a82fa51ea79b24660 to your computer and use it in GitHub Desktop.
Save eriknelson/2c27f8006ee0008a82fa51ea79b24660 to your computer and use it in GitHub Desktop.
agg := make(chan string)
for _, ch := range chans {
go func(c chan string) {
for msg := range c {
agg <- msg
}
}(ch)
}
select {
case msg <- agg:
fmt.Println("received ", msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment