Skip to content

Instantly share code, notes, and snippets.

@gsingharoy
Last active April 22, 2018 14:58
Show Gist options
  • Save gsingharoy/65c971f327071c3746bc878a8e4b47b5 to your computer and use it in GitHub Desktop.
Save gsingharoy/65c971f327071c3746bc878a8e4b47b5 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 {
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