Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templateutil/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
)

// WriteTemplateToFile executes a template with the given data and saves the result into a file.
func WriteTemplateToFile(filePath string, tmpl *template.Template, data any) error {
func WriteTemplateToFile(filePath string, tmpl Template, data any) error {
var driver bytes.Buffer

err := tmpl.Execute(&driver, data)
Expand Down
8 changes: 8 additions & 0 deletions templateutil/interface.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package templateutil

import "io"

type Template interface {
// Execute applies the template to the specified data object and writes the output to the writer.
Execute(wr io.Writer, data any) (err error)
}
Loading