Created
May 20, 2020 10:34
-
-
Save RicardoLinck/6673e4417442b65b738c7ab7ea821944 to your computer and use it in GitHub Desktop.
Fanout implementation in go.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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