From d2ea2ea09cadbc26bae478c1d3ef8c2d1d976940 Mon Sep 17 00:00:00 2001 From: erroneousboat Date: Sat, 2 Dec 2017 17:35:27 +0100 Subject: [PATCH] Add profiling endpoints --- context/context.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/context/context.go b/context/context.go index 7d2dbe6..ae985c3 100644 --- a/context/context.go +++ b/context/context.go @@ -1,6 +1,9 @@ package context import ( + "net/http" + _ "net/http/pprof" + "github.com/erroneousboat/termui" termbox "github.com/nsf/termbox-go" @@ -28,6 +31,12 @@ type AppContext struct { // CreateAppContext creates an application context which can be passed // and referenced througout the application func CreateAppContext(flgConfig string, flgDebug bool) (*AppContext, error) { + if flgDebug { + go func() { + http.ListenAndServe(":6060", nil) + }() + } + // Load config config, err := config.NewConfig(flgConfig) if err != nil {