fix: use fs.FS instead of embed.FS as argument
This commit is contained in:
parent
98eb17d9f3
commit
7e32ff6f91
1 changed files with 2 additions and 2 deletions
|
@ -2,9 +2,9 @@ package template
|
|||
|
||||
import (
|
||||
"bytes"
|
||||
"embed"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
)
|
||||
|
||||
// Engine is a template engine
|
||||
|
@ -24,7 +24,7 @@ func (e *Engine) Render(name string, data any) ([]byte, error) {
|
|||
}
|
||||
|
||||
// NewTemplateEngine creates a new template engine from the given templates
|
||||
func NewEngine(templates embed.FS) (*Engine, error) {
|
||||
func NewEngine(templates fs.FS) (*Engine, error) {
|
||||
tmpls, err := template.ParseFS(templates, "**/*.html")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to parse templates: %w", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue