diff --git a/mode.go b/mode.go index edfc2940..ca3677a9 100644 --- a/mode.go +++ b/mode.go @@ -50,8 +50,12 @@ func init() { // SetMode sets gin mode according to input string. func SetMode(value string) { + if value == "" { + value = DebugMode + } + switch value { - case DebugMode, "": + case DebugMode: ginMode = debugCode case ReleaseMode: ginMode = releaseCode @@ -60,9 +64,7 @@ func SetMode(value string) { default: panic("gin mode unknown: " + value) } - if value == "" { - value = DebugMode - } + modeName = value }