Skip to content

Commit 1a3d91b

Browse files
authored
pool: make New return pointer (#58)
1 parent 66f3f16 commit 1a3d91b

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pool/pool.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ package pool
33
import "sync"
44

55
type Pool[T any] struct {
6-
p sync.Pool
6+
p *sync.Pool
77
}
88

9-
func New[T any]() Pool[T] {
10-
return Pool[T]{sync.Pool{New: func() any { return new(T) }}}
9+
func New[T any]() *Pool[T] {
10+
return &Pool[T]{&sync.Pool{New: func() any { return new(T) }}}
1111
}
1212

1313
func (p *Pool[T]) Get() *T {

0 commit comments

Comments
 (0)