package main import ( "flag" "fmt" "os" ) const usageText = `This program runs healthcheck on the app. Usage: go run cmd/health/main.go ` func init() { flag.Usage = func() { fmt.Print(usageText) flag.PrintDefaults() os.Exit(2) } flag.Parse() } func main() { var exitCode = 1 if isOk := healthCheck(); isOk { exitCode = 0 } os.Exit(exitCode) } func healthCheck() bool { run, err := os.Open("/app.run") if err != nil { return false } defer run.Close() return true }