Use camel case instead of ALL_CAPS (#1419)
* Use camel case instead of ALL_CAPS * Update mode.go
This commit is contained in:
parent
48f6c6137c
commit
d7daffc26b
6
mode.go
6
mode.go
@ -11,8 +11,8 @@ import (
|
||||
"github.com/gin-gonic/gin/binding"
|
||||
)
|
||||
|
||||
// ENV_GIN_MODE indicates environment name for gin mode.
|
||||
const ENV_GIN_MODE = "GIN_MODE"
|
||||
// EnvGinMode indicates environment name for gin mode.
|
||||
const EnvGinMode = "GIN_MODE"
|
||||
|
||||
const (
|
||||
// DebugMode indicates gin mode is debug.
|
||||
@ -44,7 +44,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…
Reference in New Issue
Block a user