From cfb680e99a0746265fbe01f5306ef623f00c363b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 16 Jul 2021 11:54:00 +0200 Subject: [PATCH] kg: do not export handlers --- cmd/kg/handlers.go | 8 ++++---- cmd/kg/main.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmd/kg/handlers.go b/cmd/kg/handlers.go index 4e05a0a..f3c9fcf 100644 --- a/cmd/kg/handlers.go +++ b/cmd/kg/handlers.go @@ -26,12 +26,12 @@ import ( "github.com/squat/kilo/pkg/mesh" ) -type GraphHandler struct { +type graphHandler struct { mesh *mesh.Mesh granularity mesh.Granularity } -func (h *GraphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { +func (h *graphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { ns, err := h.mesh.Nodes().List() if err != nil { http.Error(w, fmt.Sprintf("failed to list nodes: %v", err), 500) @@ -124,9 +124,9 @@ func (h *GraphHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write(output) } -type HealthHandler struct { +type healthHandler struct { } -func (h *HealthHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { +func (h *healthHandler) ServeHTTP(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) } diff --git a/cmd/kg/main.go b/cmd/kg/main.go index 94b7e2f..743e7af 100644 --- a/cmd/kg/main.go +++ b/cmd/kg/main.go @@ -196,8 +196,8 @@ func Main() error { { // Run the HTTP server. mux := http.NewServeMux() - mux.Handle("/health", &HealthHandler{}) - mux.Handle("/graph", &GraphHandler{m, gr}) + mux.Handle("/health", &healthHandler{}) + mux.Handle("/graph", &graphHandler{m, gr}) mux.Handle("/metrics", promhttp.HandlerFor(r, promhttp.HandlerOpts{})) l, err := net.Listen("tcp", *listen) if err != nil {