From c833d1864ec642f1e1ae7e21b0912892621467b1 Mon Sep 17 00:00:00 2001 From: woon Date: Fri, 10 Mar 2023 08:47:01 +0800 Subject: [PATCH] update --- main.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 8645d2a..921c7be 100644 --- a/main.go +++ b/main.go @@ -16,11 +16,8 @@ import ( "github.com/joho/godotenv" ) -//go:embed statics/**/* -var staticFS embed.FS - -//go:embed tmpl/* -var tplFS embed.FS +//go:embed tmpl/* statics/**/* +var f embed.FS func main() { @@ -32,10 +29,10 @@ func main() { r := Router() // 静态文件也打包 - tmpl, _ := template.ParseFS(tplFS, "tmpl/*") + tmpl, _ := template.ParseFS(f, "tmpl/*") r.SetHTMLTemplate(tmpl) - staticFS, _ := fs.Sub(staticFS, "static") - r.StaticFS("/static", http.FS(staticFS)) + staticsFS, _ := fs.Sub(f, "statics") + r.StaticFS("/statics", http.FS(staticsFS)) //r.LoadHTMLGlob("tmpl/*") //r.Static("/statics", "./statics")