Created
April 22, 2018 15:14
-
-
Save gsingharoy/5f996edcd4008d512c6526c087e4dd5e 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 { | |
go 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