Browse Source

Fix Close() to return nil in case of no errors

A typed nil still compares non-nil when stuffed into an interface. Thanks to Tom
(ORBAT) for pointing this out.
Evan Huus 11 years ago
parent
commit
7bf1929e56
1 changed files with 4 additions and 1 deletions
  1. 4 1
      producer.go

+ 4 - 1
producer.go

@@ -208,7 +208,10 @@ func (p *Producer) Close() error {
 	for event := range p.errors {
 		errors = append(errors, event)
 	}
-	return errors
+	if len(errors) > 0 {
+		return errors
+	}
+	return nil
 }
 
 ///////////////////////////////////////////