Use fsx package and friends from pkglib

This commit is contained in:
Tom Wiesing 2023-04-08 17:51:17 +02:00
parent 1f8c55da7c
commit 0f6803f890
No known key found for this signature in database
35 changed files with 91 additions and 493 deletions

View file

@ -8,12 +8,12 @@ import (
"html/template"
"net/http"
"reflect"
"strings"
"time"
"github.com/gorilla/csrf"
"github.com/rs/zerolog"
"github.com/tkw1536/pkglib/httpx"
"github.com/tkw1536/pkglib/pools"
"github.com/tkw1536/pkglib/timex"
)
@ -251,9 +251,7 @@ func (ctx *tContext[C]) renderSafe(name string, t *template.Template, c any) (te
}
value, err, panicked := func() (value template.HTML, err error, panicked bool) {
// get a builder
builder := pools.GetBuilder()
defer pools.ReleaseBuilder(builder)
var builder strings.Builder
defer func() {
if panicked {
@ -267,7 +265,7 @@ func (ctx *tContext[C]) renderSafe(name string, t *template.Template, c any) (te
}()
panicked = true
err = t.Execute(builder, c)
err = t.Execute(&builder, c)
panicked = false
if err != nil {