mirror of
https://github.com/imgproxy/imgproxy.git
synced 2024-11-29 08:22:11 +02:00
Use strings.Builder in structdiff.Entries#String()
This commit is contained in:
parent
4d365273dc
commit
c91d109057
@ -5,6 +5,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"reflect"
|
||||
"strings"
|
||||
"sync"
|
||||
)
|
||||
|
||||
@ -14,6 +15,12 @@ var bufPool = sync.Pool{
|
||||
},
|
||||
}
|
||||
|
||||
var builderPool = sync.Pool{
|
||||
New: func() interface{} {
|
||||
return new(strings.Builder)
|
||||
},
|
||||
}
|
||||
|
||||
type Entry struct {
|
||||
Name string
|
||||
Value interface{}
|
||||
@ -22,7 +29,7 @@ type Entry struct {
|
||||
type Entries []Entry
|
||||
|
||||
func (d Entries) String() string {
|
||||
buf := bufPool.Get().(*bytes.Buffer)
|
||||
buf := builderPool.Get().(*strings.Builder)
|
||||
last := len(d) - 1
|
||||
|
||||
buf.Reset()
|
||||
|
Loading…
Reference in New Issue
Block a user