Created
February 13, 2021 02:37
-
-
Save shazadbrohi/0ba3e0b50ec179bb102b30297fe3f19d to your computer and use it in GitHub Desktop.
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
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