Skip to content

Instantly share code, notes, and snippets.

@shazadbrohi
Created February 13, 2021 02:37
Show Gist options
  • Save shazadbrohi/0ba3e0b50ec179bb102b30297fe3f19d to your computer and use it in GitHub Desktop.
Save shazadbrohi/0ba3e0b50ec179bb102b30297fe3f19d to your computer and use it in GitHub Desktop.
func fetchUrl(url string, send_channel chan<- string){
response, err := http.Get(url)
if(err != nil){
log.Fatal(err)
}
bytes, err := io.Copy(ioutil.Discard, response.Body)
response.Body.Close()
if(err != nil){
log.Fatal(err)
}
send_channel <- fmt.Sprintf("Downloaded %d bytes from URL %s", bytes, url)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment