From 8f33ce3a00d6adb3acc7de76f4b7ac004636b5e5 Mon Sep 17 00:00:00 2001 From: Marvin Steadfast Date: Mon, 3 May 2021 14:54:28 +0200 Subject: [PATCH] happy linting --- assets/prepare/assets.go | 2 +- assets/web/assets.go | 2 +- pkg/web/web.go | 17 ++++++----------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/assets/prepare/assets.go b/assets/prepare/assets.go index 3a3ecfa..8467c69 100644 --- a/assets/prepare/assets.go +++ b/assets/prepare/assets.go @@ -1,4 +1,4 @@ -//nolint:gochecknoglobals +//nolint:gochecknoglobals,golint,stylecheck package prepare import "embed" diff --git a/assets/web/assets.go b/assets/web/assets.go index 53865cb..30f21d9 100644 --- a/assets/web/assets.go +++ b/assets/web/assets.go @@ -1,4 +1,4 @@ -//nolint:gochecknoglobals +//nolint:gochecknoglobals,golint,stylecheck package web import "embed" diff --git a/pkg/web/web.go b/pkg/web/web.go index 199edc3..9225213 100644 --- a/pkg/web/web.go +++ b/pkg/web/web.go @@ -4,7 +4,6 @@ import ( "fmt" "html/template" "net/http" - "time" "github.com/prometheus/client_golang/prometheus/promhttp" "github.com/rs/zerolog/log" @@ -26,7 +25,12 @@ func root(w http.ResponseWriter, r *http.Request) { return } - t.Execute(w, struct{}{}) + if err := t.Execute(w, struct{}{}); err != nil { + logger.Error().Err(err).Msg("could not execute template") + http.Error(w, "could not execute template", http.StatusInternalServerError) + + return + } } func Run(command *cobra.Command, args []string) { @@ -44,15 +48,6 @@ func Run(command *cobra.Command, args []string) { ) http.Handle("/metrics", promhttp.Handler()) - go func() { - ticker := time.NewTicker(5 * time.Second) - - for { - <-ticker.C - log.Debug().Msg("ping") - } - }() - // Serving this thing. log.Info().Msgf("serving on %s...", l)