Skip to content

Instantly share code, notes, and snippets.

@lnds
Created March 31, 2016 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lnds/740a456f2fb061bb8b1965494ab39db0 to your computer and use it in GitHub Desktop.
Save lnds/740a456f2fb061bb8b1965494ab39db0 to your computer and use it in GitHub Desktop.
Canales en go
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