This is an automated email from the ASF dual-hosted git repository. rxl 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 84fb576 refactor: gofmt code (#75) 84fb576 is described below commit 84fb5765f1e817a2e2bdcafedcc73095c4c2f2c2 Author: xujianhai666 <52450794+xujianhai...@users.noreply.github.com> AuthorDate: Thu Oct 24 18:13:24 2019 +0800 refactor: gofmt code (#75) Motivation: code is not fmt, should be with gofmt Modifications: - gofmt once Fixes #74 Change-Id: Ic4eb14080bb0da22be418ff1385d90209f2b9d27 --- examples/consumer-listener/consumer-listener.go | 62 ++++++++++++------------- examples/consumer/consumer.go | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/examples/consumer-listener/consumer-listener.go b/examples/consumer-listener/consumer-listener.go index c20d731..0a8e6c9 100644 --- a/examples/consumer-listener/consumer-listener.go +++ b/examples/consumer-listener/consumer-listener.go @@ -18,47 +18,47 @@ package main import ( - "fmt" - "log" + "fmt" + "log" - "github.com/apache/pulsar-client-go/pulsar" + "github.com/apache/pulsar-client-go/pulsar" ) func main() { - client, err := pulsar.NewClient(pulsar.ClientOptions{URL: "pulsar://localhost:6650"}) - if err != nil { - log.Fatal(err) - } + client, err := pulsar.NewClient(pulsar.ClientOptions{URL: "pulsar://localhost:6650"}) + if err != nil { + log.Fatal(err) + } - defer client.Close() + defer client.Close() - channel := make(chan pulsar.ConsumerMessage, 100) + channel := make(chan pulsar.ConsumerMessage, 100) - options := pulsar.ConsumerOptions{ - Topic: "topic-1", - SubscriptionName: "my-subscription", - Type: pulsar.Shared, - } + options := pulsar.ConsumerOptions{ + Topic: "topic-1", + SubscriptionName: "my-subscription", + Type: pulsar.Shared, + } - options.MessageChannel = channel + options.MessageChannel = channel - consumer, err := client.Subscribe(options) - if err != nil { - log.Fatal(err) - } + consumer, err := client.Subscribe(options) + if err != nil { + log.Fatal(err) + } - defer consumer.Close() + defer consumer.Close() - // Receive messages from channel. The channel returns a struct which contains message and the consumer from where - // the message was received. It's not necessary here since we have 1 single consumer, but the channel could be - // shared across multiple consumers as well - for cm := range channel { - msg := cm.Message - fmt.Printf("Received message msgId: %v -- content: '%s'\n", - msg.ID(), string(msg.Payload())) + // Receive messages from channel. The channel returns a struct which contains message and the consumer from where + // the message was received. It's not necessary here since we have 1 single consumer, but the channel could be + // shared across multiple consumers as well + for cm := range channel { + msg := cm.Message + fmt.Printf("Received message msgId: %v -- content: '%s'\n", + msg.ID(), string(msg.Payload())) - if err := consumer.Ack(msg); err != nil { - log.Fatal(err) - } - } + if err := consumer.Ack(msg); err != nil { + log.Fatal(err) + } + } } diff --git a/examples/consumer/consumer.go b/examples/consumer/consumer.go index c408386..5250a02 100644 --- a/examples/consumer/consumer.go +++ b/examples/consumer/consumer.go @@ -22,7 +22,7 @@ import ( "fmt" "log" - "github.com/apache/pulsar-client-go/pulsar" + "github.com/apache/pulsar-client-go/pulsar" ) func main() {