Browse Source

Moving constant to client.go and making it private

Sebastien Launay 9 years ago
parent
commit
666bedf384
2 changed files with 4 additions and 4 deletions
  1. 0 2
      client.go
  2. 4 2
      config.go

+ 0 - 2
client.go

@@ -67,8 +67,6 @@ type Client interface {
 }
 
 const (
-	// Default ClientID
-	DefaultClientID = "sarama"
 	// OffsetNewest stands for the log head offset, i.e. the offset that will be
 	// assigned to the next message that will be produced to the partition. You
 	// can send this to a client's GetOffset method to get this offset, or when

+ 4 - 2
config.go

@@ -6,6 +6,8 @@ import (
 	"time"
 )
 
+const defaultClientID = "sarama"
+
 var validID *regexp.Regexp = regexp.MustCompile(`\A[A-Za-z0-9._-]+\z`)
 
 // Config is used to pass multiple configuration options to Sarama's constructors.
@@ -258,7 +260,7 @@ func NewConfig() *Config {
 
 	c.ChannelBufferSize = 256
 
-	c.ClientID = DefaultClientID
+	c.ClientID = defaultClientID
 
 	return c
 }
@@ -299,7 +301,7 @@ func (c *Config) Validate() error {
 	if c.Consumer.Offsets.Retention%time.Millisecond != 0 {
 		Logger.Println("Consumer.Offsets.Retention only supports millisecond precision; nanoseconds will be truncated.")
 	}
-	if c.ClientID == DefaultClientID {
+	if c.ClientID == defaultClientID {
 		Logger.Println("ClientID is the default of 'sarama', you should consider setting it to something application-specific.")
 	}