Skip to content

Commit

Permalink
pool: make New return pointer (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshineplan authored Jun 13, 2024
1 parent 66f3f16 commit 1a3d91b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pool/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package pool
import "sync"

type Pool[T any] struct {
p sync.Pool
p *sync.Pool
}

func New[T any]() Pool[T] {
return Pool[T]{sync.Pool{New: func() any { return new(T) }}}
func New[T any]() *Pool[T] {
return &Pool[T]{&sync.Pool{New: func() any { return new(T) }}}
}

func (p *Pool[T]) Get() *T {
Expand Down

0 comments on commit 1a3d91b

Please sign in to comment.