Skip to content

Commit 022b258

Browse files
author
gbbr
committed
Readability
1 parent 0457f7e commit 022b258

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const (
1919
pooledResources = 2 // number of resources in the pool
2020
)
2121

22-
var connectionID int32 // counter
22+
var counter int32
2323

2424
// dbConnection simulates a resource to share.
2525
type dbConnection struct {
@@ -35,7 +35,7 @@ func (dbConn *dbConnection) Close() {
3535
// createConnection is a factory method called by the pool
3636
// framework when new connections are needed.
3737
func createConnection() (pool.Resource, error) {
38-
id := atomic.AddInt32(&connectionID, 1)
38+
id := atomic.AddInt32(&counter, 1)
3939
fmt.Println("Create: New Connection", id)
4040

4141
return &dbConnection{id}, nil

0 commit comments

Comments
 (0)