From 1ffd89a91828c8b87dd6d0de6b4e288e69a14bc0 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Tue, 20 Aug 2013 20:30:57 -0700 Subject: [PATCH] serverconfig: cleanup from previous review. Addressing the comments in https://camlistore.org/r/510 Change-Id: I4523afe76805dbbb2247ece527b8e058ecd087f4 --- pkg/serverconfig/serverconfig.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkg/serverconfig/serverconfig.go b/pkg/serverconfig/serverconfig.go index 0c7ff415c..8bb160f9b 100644 --- a/pkg/serverconfig/serverconfig.go +++ b/pkg/serverconfig/serverconfig.go @@ -414,17 +414,16 @@ func (config *Config) InstallHandlers(hi HandlerInstaller, baseURL string, conte } hl.setupAll() - if os.Getenv("CAMLI_HTTP_PPROF") != "" { - hi.Handle("/debug/pprof/", &ProfileHandler{}) + if v, _ := strconv.ParseBool(os.Getenv("CAMLI_HTTP_PPROF")); v { + hi.Handle("/debug/pprof/", profileHandler{}) } return nil } -// ProfileHandler publishes server profile information. -type ProfileHandler struct { -} +// profileHandler publishes server profile information. +type profileHandler struct{} -func (ph *ProfileHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { +func (profileHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) { switch req.URL.Path { case "/debug/pprof/cmdline": pprof.Cmdline(rw, req)