1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: embed of static, views

This commit is contained in:
Steven Tang
2021-01-24 10:13:37 +11:00
parent 4e6e665e19
commit fb92747129
3 changed files with 34 additions and 4 deletions

View File

@@ -19,7 +19,7 @@ func Init() {
var templates map[string]*template.Template
func loadTemplates() {
tplPath := "/views"
const tplPath = "/views"
tpls := template.New("").Funcs(template.FuncMap{
"json": utils.Json,
"date": utils.FormatDateHuman,
@@ -46,10 +46,10 @@ func loadTemplates() {
templates = make(map[string]*template.Template)
dir, err := pkger.Open(tplPath)
defer dir.Close()
if err != nil {
panic(err)
}
defer dir.Close()
files, err := dir.Readdir(0)
if err != nil {
panic(err)