From dd4560d4f87b71a74fa21f67b74e2a947eedacba Mon Sep 17 00:00:00 2001 From: xing Date: Mon, 19 Sep 2022 12:45:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- route/route.go | 2 +- templates/templatefs.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/route/route.go b/route/route.go index dd5d64d..efa6096 100644 --- a/route/route.go +++ b/route/route.go @@ -24,7 +24,7 @@ func SetupRouter() *gin.Engine { "dateCh": func(t time.Time) interface{} { return t.Format("2006年 01月 02日") }, - }).AddTemplate() + }).SetTemplate() r.Use(middleware.SetStaticFileCache) //gzip 因为一般会用nginx做反代时自动使用gzip,所以go这边本身可以不用 /*r.Use(gzip.Gzip(gzip.DefaultCompression, gzip.WithExcludedPaths([]string{ diff --git a/templates/templatefs.go b/templates/templatefs.go index 33277ce..24a7e1e 100644 --- a/templates/templatefs.go +++ b/templates/templatefs.go @@ -20,7 +20,7 @@ func NewFsTemplate(funcMap template.FuncMap) *FsTemplate { return &FsTemplate{FuncMap: funcMap, Templates: make(map[string]*template.Template)} } -func (t *FsTemplate) AddTemplate() *FsTemplate { +func (t *FsTemplate) SetTemplate() *FsTemplate { mainTemplates, err := fs.Glob(TemplateFs, "*[^layout]/*.gohtml") if err != nil { panic(err)