Skip to content

Commit 247b746

Browse files
author
gbbr
committed
Better semantics
1 parent 4d58d76 commit 247b746

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎chapter7/patterns/pool/main/main.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func main() {
5656
// Perform queries using a connection from the pool.
5757
for q := 0; q < maxGoroutines; q++ {
5858
// TODO: Explain about closures and why we are using params
59-
go func(query int, pool pool.Interface) {
60-
performQueries(query, pool)
59+
go func(qn int, pn pool.Interface) {
60+
performQueries(qn, pn)
6161
wg.Done()
6262
}(q, p)
6363

‎chapter7/patterns/pool/pool.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ var ErrInvalidCapacity = errors.New("Capacity needs to be greater than zero.")
4343

4444
// New creates a pool from a set of factory functions. A pool provides capacity
4545
// number of resources that can be shared safely by multiple goroutines.
46-
func New(fn func() (Resource, error), capacity uint) (*pool, error) {
46+
func New(fn func() (Resource, error), capacity uint) (Interface, error) {
4747
if capacity == 0 {
4848
return nil, ErrInvalidCapacity
4949
}

0 commit comments

Comments
 (0)