From 548090e67f66acf84385c4152ca464e52d3e3319 Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 13 Sep 2024 13:01:48 +0200 Subject: Migrate away from templ and towards html/template --- vendor/github.com/a-h/templ/runtime/bufferpool.go | 38 ----------------------- 1 file changed, 38 deletions(-) delete mode 100644 vendor/github.com/a-h/templ/runtime/bufferpool.go (limited to 'vendor/github.com/a-h/templ/runtime/bufferpool.go') diff --git a/vendor/github.com/a-h/templ/runtime/bufferpool.go b/vendor/github.com/a-h/templ/runtime/bufferpool.go deleted file mode 100644 index ca2a131..0000000 --- a/vendor/github.com/a-h/templ/runtime/bufferpool.go +++ /dev/null @@ -1,38 +0,0 @@ -package runtime - -import ( - "io" - "sync" -) - -var bufferPool = sync.Pool{ - New: func() any { - return new(Buffer) - }, -} - -// GetBuffer creates and returns a new buffer if the writer is not already a buffer, -// or returns the existing buffer if it is. -func GetBuffer(w io.Writer) (b *Buffer, existing bool) { - if w == nil { - return nil, false - } - b, ok := w.(*Buffer) - if ok { - return b, true - } - b = bufferPool.Get().(*Buffer) - b.Reset(w) - return b, false -} - -// ReleaseBuffer flushes the buffer and returns it to the pool. -func ReleaseBuffer(w io.Writer) (err error) { - b, ok := w.(*Buffer) - if !ok { - return nil - } - err = b.Flush() - bufferPool.Put(b) - return err -} -- cgit v1.2.3