You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by mm...@apache.org on 2019/06/04 14:14:38 UTC

[pulsar-client-go] branch master updated: [issues 13] Fix go func(){} usage question (#14)

This is an automated email from the ASF dual-hosted git repository.

mmerli pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new ebd7667  [issues 13] Fix go func(){} usage question (#14)
ebd7667 is described below

commit ebd76677f4d69ae1635152ed477c38e9a7eb561c
Author: 冉小龙 <ra...@gmail.com>
AuthorDate: Tue Jun 4 22:14:33 2019 +0800

    [issues 13] Fix go func(){} usage question (#14)
    
    Signed-off-by: xiaolong.ran <ra...@gmail.com>
---
 pulsar/impl_producer.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pulsar/impl_producer.go b/pulsar/impl_producer.go
index b8cd715..a8764f8 100644
--- a/pulsar/impl_producer.go
+++ b/pulsar/impl_producer.go
@@ -77,10 +77,10 @@ func newProducer(client *client, options *ProducerOptions) (*producer, error) {
 	c := make(chan ProducerError, numPartitions)
 
 	for partitionIdx, partition := range partitions {
-		go func() {
-			prod, err := newPartitionProducer(client, partition, options, partitionIdx)
+		go func(index int) {
+			prod, err := newPartitionProducer(client, partition, options, index)
 			c <- ProducerError{partitionIdx, prod, err}
-		}()
+		}(partitionIdx)
 	}
 
 	for i := 0; i < numPartitions; i++ {