diff --git a/broker_test.go b/broker_test.go index 9b2fae08a..23dd573f8 100644 --- a/broker_test.go +++ b/broker_test.go @@ -145,14 +145,16 @@ func ExampleBroker() error { if err != nil { return err } + defer broker.Close() request := MetadataRequest{Topics: []string{"myTopic"}} response, err := broker.GetMetadata("myClient", &request) + if err != nil { + return err + } fmt.Println("There are", len(response.Topics), "topics active in the cluster.") - broker.Close() - return nil }