1
0
mirror of https://github.com/tmrts/go-patterns.git synced 2024-11-25 22:46:05 +03:00

Fix issue of "invalid operation:p"

When ```New``` return a reference, you have to use ```*p``` to access the reference, otherwise it's a pointer.
This commit is contained in:
genewoo 2018-10-17 15:14:01 +08:00 committed by GitHub
parent f978e42036
commit aac74afa38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -29,10 +29,10 @@ Given below is a simple lifecycle example on an object pool.
p := pool.New(2) p := pool.New(2)
select { select {
case obj := <-p: case obj := <-*p:
obj.Do( /*...*/ ) obj.Do( /*...*/ )
p <- obj *p <- obj
default: default:
// No more objects left — retry later or fail // No more objects left — retry later or fail
return return