mirror of https://github.com/gin-gonic/gin.git
Cosmetic changes
This commit is contained in:
parent
3abeba82fc
commit
ea962038e1
2
debug.go
2
debug.go
|
@ -7,7 +7,7 @@ package gin
|
|||
import "log"
|
||||
|
||||
func IsDebugging() bool {
|
||||
return gin_mode == debugCode
|
||||
return ginMode == debugCode
|
||||
}
|
||||
|
||||
func debugRoute(httpMethod, absolutePath string, handlers []HandlerFunc) {
|
||||
|
|
6
gin.go
6
gin.go
|
@ -83,8 +83,7 @@ func (engine *Engine) reuseContext(c *Context) {
|
|||
|
||||
func (engine *Engine) LoadHTMLGlob(pattern string) {
|
||||
if IsDebugging() {
|
||||
r := &render.HTMLDebugRender{Glob: pattern}
|
||||
engine.HTMLRender = r
|
||||
engine.HTMLRender = &render.HTMLDebugRender{Glob: pattern}
|
||||
} else {
|
||||
templ := template.Must(template.ParseGlob(pattern))
|
||||
engine.SetHTMLTemplate(templ)
|
||||
|
@ -93,8 +92,7 @@ func (engine *Engine) LoadHTMLGlob(pattern string) {
|
|||
|
||||
func (engine *Engine) LoadHTMLFiles(files ...string) {
|
||||
if IsDebugging() {
|
||||
r := &render.HTMLDebugRender{Files: files}
|
||||
engine.HTMLRender = r
|
||||
engine.HTMLRender = &render.HTMLDebugRender{Files: files}
|
||||
} else {
|
||||
templ := template.Must(template.ParseFiles(files...))
|
||||
engine.SetHTMLTemplate(templ)
|
||||
|
|
14
mode.go
14
mode.go
|
@ -22,8 +22,8 @@ const (
|
|||
testCode = iota
|
||||
)
|
||||
|
||||
var gin_mode int = debugCode
|
||||
var mode_name string = DebugMode
|
||||
var ginMode int = debugCode
|
||||
var modeName string = DebugMode
|
||||
|
||||
func init() {
|
||||
value := os.Getenv(GIN_MODE)
|
||||
|
@ -37,17 +37,17 @@ func init() {
|
|||
func SetMode(value string) {
|
||||
switch value {
|
||||
case DebugMode:
|
||||
gin_mode = debugCode
|
||||
ginMode = debugCode
|
||||
case ReleaseMode:
|
||||
gin_mode = releaseCode
|
||||
ginMode = releaseCode
|
||||
case TestMode:
|
||||
gin_mode = testCode
|
||||
ginMode = testCode
|
||||
default:
|
||||
log.Panic("gin mode unknown: " + value)
|
||||
}
|
||||
mode_name = value
|
||||
modeName = value
|
||||
}
|
||||
|
||||
func Mode() string {
|
||||
return mode_name
|
||||
return modeName
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue