Cosmetic changes

This commit is contained in:
Manu Mtz-Almeida 2015-04-07 12:27:23 +02:00
parent 3abeba82fc
commit ea962038e1
3 changed files with 10 additions and 12 deletions

View File

@ -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
View File

@ -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
View File

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