forked from chemidy/smallest-secured-golang-docker-image
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
32 lines (25 loc) · 705 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package main
import (
"fmt"
"net/http"
"time"
)
func checkWebsite(website string) error {
tz, _ := time.LoadLocation("Europe/Paris")
now := time.Now()
parisTime := now.In(tz)
resp, err := http.Get(website)
if err != nil {
return err
}
if resp.StatusCode >= 200 && resp.StatusCode <= 299 {
fmt.Println("Website :", website, "is Up", "HTTP Response Status:", resp.StatusCode, http.StatusText(resp.StatusCode))
} else {
fmt.Println("Website :", website, " Broken", "HTTP Response Status:", resp.StatusCode, http.StatusText(resp.StatusCode))
}
fmt.Println("Paris is magic : what time is it in Paris ?", parisTime)
return err
}
func main() {
checkWebsite("https://chemidy.cloud")
}