3028fe7eaa
Linting Updates * precommit * smallerchecks * govuln
29 lines
370 B
Go
29 lines
370 B
Go
// cmd/healthcheck/main.go
|
|
package main
|
|
|
|
import (
|
|
"errors"
|
|
"net/http"
|
|
"os"
|
|
)
|
|
|
|
func main() {
|
|
err := check()
|
|
if err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
|
|
func check() error {
|
|
resp, err := http.Get("http://localhost:8080/health")
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer resp.Body.Close()
|
|
|
|
if resp.StatusCode != 200 {
|
|
return errors.New("Status code not OK")
|
|
}
|
|
return nil
|
|
}
|