gocustomurls/embed.go

31 lines
574 B
Go

package main
import (
"embed"
"html/template"
)
// https://stackoverflow.com/questions/70193820/why-isnt-go-embedding-files
//
//go:embed templates/*
var tmpls embed.FS
func getServeHtml() (*template.Template, error) {
var t *template.Template
data, err := tmpls.ReadFile("templates/success.html")
if err != nil {
return t, err
}
return template.New("").Parse(string(data))
}
func getDefaultHtml() ([]byte, error) {
var data []byte
var err error
data, err = tmpls.ReadFile("templates/default.html")
if err != nil {
return data, err
}
return data, nil
}