mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-22 09:34:33 +08:00
Use camel case instead of ALL_CAPS
This commit is contained in:
parent
1c4cbfae59
commit
c88d36b6ec
4
mode.go
4
mode.go
@ -11,7 +11,7 @@ import (
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
const ENV_GIN_MODE = "GIN_MODE"
|
||||
const EnvGinMode = "GIN_MODE"
|
||||
|
||||
const (
|
||||
DebugMode = "debug"
|
||||
@ -38,7 +38,7 @@ var ginMode = debugCode
|
||||
var modeName = DebugMode
|
||||
|
||||
func init() {
|
||||
mode := os.Getenv(ENV_GIN_MODE)
|
||||
mode := os.Getenv(EnvGinMode)
|
||||
SetMode(mode)
|
||||
}
|
||||
|
||||
|
@ -13,13 +13,13 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
os.Setenv(ENV_GIN_MODE, TestMode)
|
||||
os.Setenv(EnvGinMode, TestMode)
|
||||
}
|
||||
|
||||
func TestSetMode(t *testing.T) {
|
||||
assert.Equal(t, testCode, ginMode)
|
||||
assert.Equal(t, TestMode, Mode())
|
||||
os.Unsetenv(ENV_GIN_MODE)
|
||||
os.Unsetenv(EnvGinMode)
|
||||
|
||||
SetMode("")
|
||||
assert.Equal(t, debugCode, ginMode)
|
||||
|
Loading…
x
Reference in New Issue
Block a user