Use camel case instead of ALL_CAPS (#1419)

* Use camel case instead of ALL_CAPS

* Update mode.go
This commit is contained in:
David Zhang 2019-02-22 12:53:47 +08:00 committed by 田欧
parent 48f6c6137c
commit d7daffc26b
2 changed files with 5 additions and 5 deletions

View File

@ -11,8 +11,8 @@ import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
) )
// ENV_GIN_MODE indicates environment name for gin mode. // EnvGinMode indicates environment name for gin mode.
const ENV_GIN_MODE = "GIN_MODE" const EnvGinMode = "GIN_MODE"
const ( const (
// DebugMode indicates gin mode is debug. // DebugMode indicates gin mode is debug.
@ -44,7 +44,7 @@ var ginMode = debugCode
var modeName = DebugMode var modeName = DebugMode
func init() { func init() {
mode := os.Getenv(ENV_GIN_MODE) mode := os.Getenv(EnvGinMode)
SetMode(mode) SetMode(mode)
} }

View File

@ -13,13 +13,13 @@ import (
) )
func init() { func init() {
os.Setenv(ENV_GIN_MODE, TestMode) os.Setenv(EnvGinMode, TestMode)
} }
func TestSetMode(t *testing.T) { func TestSetMode(t *testing.T) {
assert.Equal(t, testCode, ginMode) assert.Equal(t, testCode, ginMode)
assert.Equal(t, TestMode, Mode()) assert.Equal(t, TestMode, Mode())
os.Unsetenv(ENV_GIN_MODE) os.Unsetenv(EnvGinMode)
SetMode("") SetMode("")
assert.Equal(t, debugCode, ginMode) assert.Equal(t, debugCode, ginMode)