Skip to content

Instantly share code, notes, and snippets.

@gsingharoy
Created April 22, 2018 15:14
Show Gist options
  • Save gsingharoy/5f996edcd4008d512c6526c087e4dd5e to your computer and use it in GitHub Desktop.
Save gsingharoy/5f996edcd4008d512c6526c087e4dd5e to your computer and use it in GitHub Desktop.
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