RichΛrd 0babdad17b
chore: upgrade go-waku to v0.5 (#3213)
* chore: upgrade go-waku to v0.5
* chore: add println and logs to check what's being stored in the enr, and preemptively delete the multiaddr field (#3219)
* feat: add wakuv2 test (#3218)
2023-02-22 17:58:17 -04:00

27 lines
439 B
Go

package metricshelper
import (
"fmt"
"sync"
)
const capacity = 8
var stringPool = sync.Pool{New: func() any {
s := make([]string, 0, capacity)
return &s
}}
func GetStringSlice() *[]string {
s := stringPool.Get().(*[]string)
*s = (*s)[:0]
return s
}
func PutStringSlice(s *[]string) {
if c := cap(*s); c < capacity {
panic(fmt.Sprintf("expected a string slice with capacity 8 or greater, got %d", c))
}
stringPool.Put(s)
}