Use camel case instead of ALL_CAPS

This commit is contained in:
David Zhang 2018-07-02 15:53:56 +08:00
parent 1c4cbfae59
commit c88d36b6ec
2 changed files with 4 additions and 4 deletions

View File

@ -11,7 +11,7 @@ import (
"github.com/gin-gonic/gin/binding" "github.com/gin-gonic/gin/binding"
) )
const ENV_GIN_MODE = "GIN_MODE" const EnvGinMode = "GIN_MODE"
const ( const (
DebugMode = "debug" DebugMode = "debug"
@ -38,7 +38,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)