Created
March 31, 2016 15:31
-
-
Save lnds/740a456f2fb061bb8b1965494ab39db0 to your computer and use it in GitHub Desktop.
Canales en go
This file contains 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
ch := make(chan WeatherReport) | |
for _, city := range cities { | |
go fetch(city, ch) // fetch call api and put response in ch | |
} | |
for range cities { | |
rep := <- ch | |
reports = append(reports, rep) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment