Skip to content

Commit

Permalink
small lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
  • Loading branch information
jkroepke committed Dec 26, 2024
1 parent e3f9ec9 commit d86fc90
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
17 changes: 7 additions & 10 deletions cmd/daemon/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)

Expand Down
5 changes: 5 additions & 0 deletions cmd/daemon/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit d86fc90

Please sign in to comment.