From c9ee79fc54f00ab74234a31ba44f6682a47722b8 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Sun, 15 Mar 2015 14:19:37 +0100 Subject: [PATCH] DebugIf: only test function when tag is enabled --- debug/debug.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/debug/debug.go b/debug/debug.go index 239d6ff53..5ade4878a 100644 --- a/debug/debug.go +++ b/debug/debug.go @@ -173,6 +173,11 @@ func Break(tag string) { // is contained in the DEBUG_BREAK environment variable and the return value of // fn is true. func BreakIf(tag string, fn func() bool) { + // check if breaking is enabled + if v, ok := opts.breaks[tag]; !ok || !v { + return + } + if fn() { Break(tag) }