From a481672c5cec1efe8d4856b393e98775c55ad8bc Mon Sep 17 00:00:00 2001
From: Justin Nuß <justin.nuss@hmmh.de>
Date: Fri, 4 Jul 2014 11:41:43 +0200
Subject: Add 'pprof' tag for enabling debugging

---
 routers/debug/debug.go   | 16 ++++++++++++++++
 routers/debug/ignored.go | 11 +++++++++++
 2 files changed, 27 insertions(+)
 create mode 100644 routers/debug/debug.go
 create mode 100644 routers/debug/ignored.go

(limited to 'routers/debug')

diff --git a/routers/debug/debug.go b/routers/debug/debug.go
new file mode 100644
index 00000000..c332dbea
--- /dev/null
+++ b/routers/debug/debug.go
@@ -0,0 +1,16 @@
+// +build pprof
+
+package debug
+
+import (
+	"net/http/pprof"
+
+	"github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+	r.Get("/debug/pprof/cmdline", pprof.Cmdline)
+	r.Get("/debug/pprof/profile", pprof.Profile)
+	r.Get("/debug/pprof/symbol", pprof.Symbol)
+	r.Get("/debug/pprof/**", pprof.Index)
+}
diff --git a/routers/debug/ignored.go b/routers/debug/ignored.go
new file mode 100644
index 00000000..4ec49964
--- /dev/null
+++ b/routers/debug/ignored.go
@@ -0,0 +1,11 @@
+// +build !pprof
+
+package debug
+
+import (
+	"github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+	// do nothing
+}
-- 
cgit v1.2.3