Browse Source

client: fix returning the wrong error

err goes out of scope at the end of the if-block

Bug found with ineffassign.
Damian Gryski 9 years ago
parent
commit
a3b3155d09
1 changed files with 1 additions and 1 deletions
  1. 1 1
      client.go

+ 1 - 1
client.go

@@ -290,7 +290,7 @@ func (client *client) Leader(topic string, partitionID int32) (*Broker, error) {
 	leader, err := client.cachedLeader(topic, partitionID)
 
 	if leader == nil {
-		err := client.RefreshMetadata(topic)
+		err = client.RefreshMetadata(topic)
 		if err != nil {
 			return nil, err
 		}