From 641bd6a9e9a3a4b6fa2cd622fc8b8e315520da4c Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 16 Jul 2021 12:10:13 +0200 Subject: [PATCH] register health handler with HandleFunc --- cmd/kg/handlers.go | 5 +---- cmd/kg/main.go | 2 +- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/cmd/kg/handlers.go b/cmd/kg/handlers.go index da001eb..3296a7a 100644 --- a/cmd/kg/handlers.go +++ b/cmd/kg/handlers.go @@ -118,9 +118,6 @@ func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write(output) } -type healthHandler struct { -} - -func (h *healthHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { +func healthHandler(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) } diff --git a/cmd/kg/main.go b/cmd/kg/main.go index 3ac6ae4..3baeec5 100644 --- a/cmd/kg/main.go +++ b/cmd/kg/main.go @@ -196,7 +196,7 @@ func Main() error { { // Run the HTTP server. mux := http.NewServeMux() - mux.Handle("/health", &healthHandler{}) + mux.HandleFunc("/health", healthHandler) mux.Handle("/graph", &graphHandler{m, gr, hostname, s}) mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{})) l, err := net.Listen("tcp", *listen)