Skip to content

Instantly share code, notes, and snippets.

@dipeshhkc
Last active May 22, 2021 10:31
Show Gist options
  • Save dipeshhkc/a873773309b2c367dc676019511eecfa to your computer and use it in GitHub Desktop.
Save dipeshhkc/a873773309b2c367dc676019511eecfa to your computer and use it in GitHub Desktop.
func main() {
websites := []string{
"https://stackoverflow.com/",
"https://github.com/",
"https://www.linkedin.com/",
"http://medium.com/",
"https://golang.org/",
"https://www.udemy.com/",
"https://www.coursera.org/",
"https://wesionary.team/",
}
for _, website := range websites {
getWebsite(website)
}
}
func getWebsite(website string) {
if res, err := http.Get(website); err != nil {
fmt.Println(website, "is down")
} else {
fmt.Printf("[%d] %s is up\n", res.StatusCode, website)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment