simplefileshare/templates.go

29 lines
472 B
Go
Raw Permalink Normal View History

2021-08-31 19:07:19 +05:00
package main
import (
"embed"
2021-08-31 19:07:19 +05:00
"html/template"
log "github.com/sirupsen/logrus"
)
var templates *template.Template
//go:embed templates/*.htm
var templatesFS embed.FS
2021-08-31 19:07:19 +05:00
func initTemplates() error {
log.Debugln("Templates initialization started.")
defer log.Debugln("Templates initialization finished.")
var err error
templates, err = template.ParseFS(templatesFS, "templates/index.htm")
2021-08-31 19:07:19 +05:00
if err != nil {
return err
}
templatesFS = embed.FS{}
2021-08-31 19:07:19 +05:00
return nil
}