Browse Source

Use camel case instead of ALL_CAPS (#1419)

* Use camel case instead of ALL_CAPS

* Update mode.go
David Zhang 6 years ago
parent
commit
d7daffc26b
2 changed files with 5 additions and 5 deletions
  1. 3 3
      mode.go
  2. 2 2
      mode_test.go

+ 3 - 3
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)
 }
 

+ 2 - 2
mode_test.go

@@ -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)