package frontend import ( "embed" "html/template" "io/fs" ) var ( //go:embed static static embed.FS Static fs.FS //go:embed *.html templatesFS embed.FS Templates *template.Template funcs = template.FuncMap{ "version": func() string { return "better-zwave-locks v0.x.x aaaaaaaa" }, } ) func init() { t := template.New("").Funcs(funcs) var err error Templates, err = t.ParseFS(templatesFS, "*") if err != nil { panic(err) } Static, err = fs.Sub(static, "static") if err != nil { panic(err) } }