Problem
status.go has two near-identical functions:
pingEndpoint(url, kind) string — returns emoji (✅, ❌, ⚠️)
checkEndpointHealth(url, kind) bool — returns true/false
Both build the check URL the same way (append /ping for backend, /api/health for Grafana), create an http.Client with the same timeout (8s), make the same GET request, and check the same status code range. The only difference is the return type.
Fix
Refactor into one function and have the other call it:
`go
func checkEndpointHealth(url string, kind string) bool {
// ... shared logic ...
}
func pingEndpoint(url string, kind string) string {
if checkEndpointHealth(url, kind) {
return "✅"
}
return "❌"
}
`
(The ⚠️ case for non-2xx status codes would need a slightly different signature, but the core logic is shared.)
Acceptance Criteria
Problem
status.gohas two near-identical functions:pingEndpoint(url, kind) string— returns emoji (✅, ❌,checkEndpointHealth(url, kind) bool— returns true/falseBoth build the check URL the same way (append
/pingfor backend,/api/healthfor Grafana), create anhttp.Clientwith the same timeout (8s), make the same GET request, and check the same status code range. The only difference is the return type.Fix
Refactor into one function and have the other call it:
`go
func checkEndpointHealth(url string, kind string) bool {
// ... shared logic ...
}
func pingEndpoint(url string, kind string) string {
if checkEndpointHealth(url, kind) {
return "✅"
}
return "❌"
}
`
(The⚠️ case for non-2xx status codes would need a slightly different signature, but the core logic is shared.)
Acceptance Criteria
statuscommand output unchanged (same emojis, same JSON fields)go build ./...andgo test ./...pass