Skip to content

Instantly share code, notes, and snippets.

@RicardoLinck
Created May 20, 2020 10:34
Show Gist options
  • Save RicardoLinck/6673e4417442b65b738c7ab7ea821944 to your computer and use it in GitHub Desktop.
Save RicardoLinck/6673e4417442b65b738c7ab7ea821944 to your computer and use it in GitHub Desktop.
Fanout implementation in go.
package main
func queryFanOut(urls []string) string {
ch := make(chan string, len(urls))
for _, url := range urls {
go func(u string) {
ch <- executeQuery(u)
}(url)
}
return <-ch
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment