mirror of https://github.com/gin-gonic/gin.git
update:SetMode function (#2321)
This commit is contained in:
parent
4f208887e1
commit
a4e947a356
10
mode.go
10
mode.go
|
@ -50,8 +50,12 @@ func init() {
|
||||||
|
|
||||||
// SetMode sets gin mode according to input string.
|
// SetMode sets gin mode according to input string.
|
||||||
func SetMode(value string) {
|
func SetMode(value string) {
|
||||||
|
if value == "" {
|
||||||
|
value = DebugMode
|
||||||
|
}
|
||||||
|
|
||||||
switch value {
|
switch value {
|
||||||
case DebugMode, "":
|
case DebugMode:
|
||||||
ginMode = debugCode
|
ginMode = debugCode
|
||||||
case ReleaseMode:
|
case ReleaseMode:
|
||||||
ginMode = releaseCode
|
ginMode = releaseCode
|
||||||
|
@ -60,9 +64,7 @@ func SetMode(value string) {
|
||||||
default:
|
default:
|
||||||
panic("gin mode unknown: " + value)
|
panic("gin mode unknown: " + value)
|
||||||
}
|
}
|
||||||
if value == "" {
|
|
||||||
value = DebugMode
|
|
||||||
}
|
|
||||||
modeName = value
|
modeName = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue