package checkup import ( "fmt" "net/http" "time" ) func HttpStatusOK(url string, timeout, status int) error { client := &http.Client{Timeout: time.Duration(timeout) * time.Second} resp, err := client.Get(url) if err != nil { return err } defer resp.Body.Close() if resp.StatusCode != status { return fmt.Errorf("Bad status code, expected %d got: %d", status, resp.StatusCode) } return nil }