Last active
April 22, 2018 14:58
-
-
Save gsingharoy/65c971f327071c3746bc878a8e4b47b5 to your computer and use it in GitHub Desktop.
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
package main | |
import ( | |
"fmt" | |
"net/http" | |
) | |
func main() { | |
// A slice of sample websites | |
urls := []string{ | |
"https://www.easyjet.com/", | |
"https://www.skyscanner.de/", | |
"https://www.ryanair.com", | |
"https://wizzair.com/", | |
"https://www.swiss.com/", | |
} | |
for _, url := range urls { | |
checkUrl(url) | |
} | |
} | |
//checks and prints a message if a website is up or down | |
func checkUrl(url string) { | |
_, err := http.Get(url) | |
if err != nil { | |
fmt.Println(url, "is down !!!") | |
return | |
} | |
fmt.Println(url, "is up and running.") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment