From 7b508186dd71146cbdb3d14f2c2e1aaaa51f7e45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E6=AC=A7?= Date: Wed, 19 Jul 2017 20:49:18 +0800 Subject: [PATCH] style: remove optional return (#1036) --- auth.go | 1 - gin.go | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/auth.go b/auth.go index 75a7c89..c214e21 100644 --- a/auth.go +++ b/auth.go @@ -58,7 +58,6 @@ func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc { // The user credentials was found, set user's id to key AuthUserKey in this context, the user's id can be read later using // c.MustGet(gin.AuthUserKey) c.Set(AuthUserKey, user) - return } } diff --git a/gin.go b/gin.go index fc9214d..0372931 100644 --- a/gin.go +++ b/gin.go @@ -158,9 +158,9 @@ func (engine *Engine) LoadHTMLGlob(pattern string) { engine.HTMLRender = render.HTMLDebug{Glob: pattern, FuncMap: engine.FuncMap, Delims: engine.delims} return } + templ := template.Must(template.New("").Delims(engine.delims.Left, engine.delims.Right).Funcs(engine.FuncMap).ParseGlob(pattern)) engine.SetHTMLTemplate(templ) - return } func (engine *Engine) LoadHTMLFiles(files ...string) { @@ -168,9 +168,9 @@ func (engine *Engine) LoadHTMLFiles(files ...string) { engine.HTMLRender = render.HTMLDebug{Files: files, FuncMap: engine.FuncMap, Delims: engine.delims} return } + templ := template.Must(template.New("").Delims(engine.delims.Left, engine.delims.Right).Funcs(engine.FuncMap).ParseFiles(files...)) engine.SetHTMLTemplate(templ) - return } func (engine *Engine) SetHTMLTemplate(templ *template.Template) {