From d86fc901a27c5fca72887ae6c9109553e772220b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Thu, 26 Dec 2024 21:54:20 +0100 Subject: [PATCH] small lint fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan-Otto Kröpke --- cmd/daemon/root.go | 17 +++++++---------- cmd/daemon/root_test.go | 5 +++++ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cmd/daemon/root.go b/cmd/daemon/root.go index 7b99291..28ba87a 100644 --- a/cmd/daemon/root.go +++ b/cmd/daemon/root.go @@ -159,10 +159,7 @@ func Execute(args []string, logWriter io.Writer, version, commit, date string) i switch sig { case syscall.SIGHUP: if err = server.Reload(); err != nil { - err := fmt.Errorf("error reloading http server: %w", err) - logger.Error(err.Error()) - - cancel(err) + cancel(fmt.Errorf("error reloading http server: %w", err)) } default: cancel(nil) @@ -173,12 +170,12 @@ func Execute(args []string, logWriter io.Writer, version, commit, date string) i func setupDebugListener(ctx context.Context, logger *slog.Logger, conf config.Config) error { mux := http.NewServeMux() - mux.Handle("/", http.RedirectHandler("/debug/pprof/", http.StatusTemporaryRedirect)) - mux.HandleFunc("/debug/pprof/", pprof.Index) - mux.HandleFunc("/debug/pprof/cmdline", pprof.Cmdline) - mux.HandleFunc("/debug/pprof/profile", pprof.Profile) - mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol) - mux.HandleFunc("/debug/pprof/trace", pprof.Trace) + mux.Handle("GET /", http.RedirectHandler("/debug/pprof/", http.StatusTemporaryRedirect)) + mux.HandleFunc("GET /debug/pprof/", pprof.Index) + mux.HandleFunc("GET /debug/pprof/cmdline", pprof.Cmdline) + mux.HandleFunc("GET /debug/pprof/profile", pprof.Profile) + mux.HandleFunc("GET /debug/pprof/symbol", pprof.Symbol) + mux.HandleFunc("GET /debug/pprof/trace", pprof.Trace) server := httpserver.NewHTTPServer(httpserver.ServerNameDebug, logger, config.HTTP{Listen: conf.Debug.Listen}, mux) diff --git a/cmd/daemon/root_test.go b/cmd/daemon/root_test.go index 3083ecf..c94c7bf 100644 --- a/cmd/daemon/root_test.go +++ b/cmd/daemon/root_test.go @@ -65,6 +65,11 @@ func TestExecuteConfigInvalid(t *testing.T) { []string{"", "--config=../../config.example.yaml", "--log.format=console", "--log.level=info", "--http.secret=" + testutils.Secret, "--http.listen=127.0.0.1:0"}, `error oidc provider`, }, + { + "error oidc invalid provider", + []string{"", "--config=../../config.example.yaml", "--log.format=console", "--log.level=info", "--http.secret=" + testutils.Secret, "--http.listen=127.0.0.1:0", "--oauth2.provider=invalid"}, + `unknown oauth2 provider: invalid`, + }, { "error http listener", []string{