Skip to content

Commit

Permalink
fix: go lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
WoozyMasta committed Dec 6, 2024
1 parent f24c81c commit 79b8927
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions cli/probes.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package main
import (
"net/http"

log "github.com/sirupsen/logrus"
"github.com/woozymasta/dayz-exporter/pkg/config"
)

Expand All @@ -16,13 +17,17 @@ func (c *connection) livenessHandler(w http.ResponseWriter, r *http.Request) {
}

w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
if _, err := w.Write([]byte("OK")); err != nil {
log.Errorf("liveness probe: %v", err)
}
}

// simple OK if up and ready to handle requests
func (c *connection) readinessHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
w.Write([]byte("OK"))
if _, err := w.Write([]byte("OK")); err != nil {
log.Errorf("readiness probe: %v", err)
}
}

func (c *connection) rootHandler(w http.ResponseWriter, r *http.Request) {
Expand All @@ -33,7 +38,7 @@ func (c *connection) rootHandler(w http.ResponseWriter, r *http.Request) {

w.Header().Set("Content-Type", "text/html")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
_, err := w.Write([]byte(`
<!DOCTYPE html>
<html lang="en">
<head>
Expand Down Expand Up @@ -71,4 +76,8 @@ func (c *connection) rootHandler(w http.ResponseWriter, r *http.Request) {
</body>
</html>
`))

if err != nil {
log.Errorf("index page: %v", err)
}
}

0 comments on commit 79b8927

Please sign in to comment.