Refactor more things into class

This commit is contained in:
2024-09-12 15:50:02 +02:00
parent a5d6fa15a3
commit 3994b5aa74
2 changed files with 21 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
package main
import (
_ "embed"
"fmt"
"log"
"os"
@@ -12,6 +13,25 @@ import (
"github.com/davecgh/go-spew/spew"
)
//go:embed class.tmpl
var templatestr string
var classTemplate *template.Template
var fns = template.FuncMap{
"plus1": func(x int) int {
return x + 1
},
}
func init() {
var err error
classTemplate, err = template.New("class").Funcs(fns).Parse(templatestr)
if err != nil {
Error.Printf("Error parsing template: %v", err)
return
}
}
type (
Class struct {
ClassName string