From aac74afa386ebec1b7b2ecdbe0d564db68fba68c Mon Sep 17 00:00:00 2001 From: genewoo Date: Wed, 17 Oct 2018 15:14:01 +0800 Subject: [PATCH] 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. --- creational/object-pool.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/creational/object-pool.md b/creational/object-pool.md index c50667d..8accce7 100644 --- a/creational/object-pool.md +++ b/creational/object-pool.md @@ -29,10 +29,10 @@ Given below is a simple lifecycle example on an object pool. p := pool.New(2) select { -case obj := <-p: +case obj := <-*p: obj.Do( /*...*/ ) - p <- obj + *p <- obj default: // No more objects left — retry later or fail return