From fd2e342569850bca6285955b88246bc29cbd3b3f Mon Sep 17 00:00:00 2001 From: Manu Mtz-Almeida Date: Mon, 8 Sep 2014 20:54:08 +0200 Subject: [PATCH] Adds API for interrogating current mode It returns one of the following values: - gin. DebugMode - gin. ReleaseMode - gin. TestMode --- mode.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mode.go b/mode.go index 166c09c0..9856789c 100644 --- a/mode.go +++ b/mode.go @@ -22,6 +22,7 @@ const ( ) var gin_mode int = debugCode +var mode_name string = DebugMode func SetMode(value string) { switch value { @@ -34,6 +35,11 @@ func SetMode(value string) { default: panic("gin mode unknown, the allowed modes are: " + DebugMode + " and " + ReleaseMode) } + mode_name = value +} + +func Mode() string { + return mode_name } func init() {