pkg/pool/pool.go
func New(minSize, maxSize int, factor float64, makeFunc func(int) interface{}) *Pool {
	if minSize < 1 {
		panic("invalid minimum pool size")
	}
	if maxSize < 1 {
		panic("invalid maximum pool size")
	}
	if factor < 1 {
		panic("invalid factor")
	}

	var sizes []int

	for s := minSize; s <= maxSize; s = int(float64(s) * factor) {
		sizes = append(sizes, s)
	}

	p := &Pool{
		buckets: make([]sync.Pool, len(sizes)),
		sizes:   sizes,
		make:    makeFunc,
	}

	return p
}
func New(minSize, maxSize int, factor float64, makeFunc func(int) interface{}) *Pool {
	if minSize < 1 {
		panic("invalid minimum pool size")
	}
	if maxSize < 1 {
		panic("invalid maximum pool size")
	}
	if factor < 1 {
		panic("invalid factor")
	}

	var sizes []int

	for s := minSize; s <= maxSize; s = int(float64(s) * factor) {
		sizes = append(sizes, s)
	}

	p := &Pool{
		buckets: make([]sync.Pool, len(sizes)),
		sizes:   sizes,
		make:    makeFunc,
	}

	return p
}
func New ( minSize , maxSize int , factor float64 , makeFunc func ( int ) interface { } ) * Pool { if minSize < 1 { panic ( " " ) } if maxSize < 1 { panic ( " " ) } if factor < 1 { panic ( " " ) } var sizes [ ] int for s := minSize ; s <= maxSize ; s = int ( float64 ( s ) * factor ) { sizes = append ( sizes , s ) } p := & Pool { buckets : make ( [ ] sync . Pool , len ( sizes ) ) , sizes : sizes , make : makeFunc , } return p }
// New returns a new Pool with size buckets for minSize to maxSize
// increasing by the given factor.
New returns a new Pool with size buckets for minSize to maxSize increasing by the given factor .