Forgot the go fmt.

master
Zed A. Shaw 3 days ago
parent e10cc57bec
commit 0df151c7e4
  1. 14
      main.go

@ -2,6 +2,7 @@ package main
import ( import (
"bytes" "bytes"
_ "embed"
"flag" "flag"
"fmt" "fmt"
"github.com/fsnotify/fsnotify" "github.com/fsnotify/fsnotify"
@ -15,7 +16,6 @@ import (
"strings" "strings"
"text/template" "text/template"
"time" "time"
_ "embed"
) )
//go:embed example/.ssgod.json //go:embed example/.ssgod.json
@ -56,7 +56,9 @@ func RenderTemplate(out io.Writer, embed string, variables any) error {
callbacks := template.FuncMap{ callbacks := template.FuncMap{
"embed": func() string { "embed": func() string {
tmpl, err = tmpl.Parse(embed) tmpl, err = tmpl.Parse(embed)
if err != nil { Fatal(err, "error in your template") } if err != nil {
Fatal(err, "error in your template")
}
out := bytes.NewBuffer(make([]byte, 0, 100)) out := bytes.NewBuffer(make([]byte, 0, 100))
tmpl.Execute(out, variables) tmpl.Execute(out, variables)
return out.String() return out.String()
@ -264,10 +266,14 @@ func RenderPages() {
err := filepath.WalkDir(config.Settings.Views, err := filepath.WalkDir(config.Settings.Views,
func(path string, d fs.DirEntry, err error) error { func(path string, d fs.DirEntry, err error) error {
if err != nil { return err } if err != nil {
return err
}
err = ProcessDirEntry(path, d, meta) err = ProcessDirEntry(path, d, meta)
if err != nil { return Fail(err, "failed to process %s", path) } if err != nil {
return Fail(err, "failed to process %s", path)
}
return err return err
}) })

Loading…
Cancel
Save