update:SetMode function (#2321)

This commit is contained in:
bestgopher 2020-04-16 22:31:58 +08:00 committed by GitHub
parent 4f208887e1
commit a4e947a356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

10
mode.go
View File

@ -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
}