@@ -133,11 +133,9 @@ const (
133
133
ReadCommitted IsolationLevel = 1
134
134
)
135
135
136
- var (
137
- // DefaultClientID is the default value used as ClientID of kafka
138
- // connections.
139
- DefaultClientID string
140
- )
136
+ // DefaultClientID is the default value used as ClientID of kafka
137
+ // connections.
138
+ var DefaultClientID string
141
139
142
140
func init () {
143
141
progname := filepath .Base (os .Args [0 ])
@@ -263,10 +261,12 @@ func (c *Conn) Controller() (broker Broker, err error) {
263
261
}
264
262
for _ , brokerMeta := range res .Brokers {
265
263
if brokerMeta .NodeID == res .ControllerID {
266
- broker = Broker {ID : int (brokerMeta .NodeID ),
264
+ broker = Broker {
265
+ ID : int (brokerMeta .NodeID ),
267
266
Port : int (brokerMeta .Port ),
268
267
Host : brokerMeta .Host ,
269
- Rack : brokerMeta .Rack }
268
+ Rack : brokerMeta .Rack ,
269
+ }
270
270
break
271
271
}
272
272
}
@@ -322,7 +322,6 @@ func (c *Conn) findCoordinator(request findCoordinatorRequestV0) (findCoordinato
322
322
err := c .readOperation (
323
323
func (deadline time.Time , id int32 ) error {
324
324
return c .writeRequest (findCoordinator , v0 , id , request )
325
-
326
325
},
327
326
func (deadline time.Time , size int ) error {
328
327
return expectZeroSize (func () (remain int , err error ) {
@@ -752,9 +751,8 @@ func (c *Conn) ReadBatch(minBytes, maxBytes int) *Batch {
752
751
// ReadBatchWith in every way is similar to ReadBatch. ReadBatch is configured
753
752
// with the default values in ReadBatchConfig except for minBytes and maxBytes.
754
753
func (c * Conn ) ReadBatchWith (cfg ReadBatchConfig ) * Batch {
755
-
756
754
var adjustedDeadline time.Time
757
- var maxFetch = int (c .fetchMaxBytes )
755
+ maxFetch : = int (c .fetchMaxBytes )
758
756
759
757
if cfg .MinBytes < 0 || cfg .MinBytes > maxFetch {
760
758
return & Batch {err : fmt .Errorf ("kafka.(*Conn).ReadBatch: minBytes of %d out of [1,%d] bounds" , cfg .MinBytes , maxFetch )}
@@ -859,11 +857,7 @@ func (c *Conn) ReadBatchWith(cfg ReadBatchConfig) *Batch {
859
857
860
858
var msgs * messageSetReader
861
859
if err == nil {
862
- if highWaterMark == offset {
863
- msgs = & messageSetReader {empty : true }
864
- } else {
865
- msgs , err = newMessageSetReader (& c .rbuf , remain )
866
- }
860
+ msgs , err = newMessageSetReader (& c .rbuf , remain )
867
861
}
868
862
if err == errShortRead {
869
863
err = checkTimeoutErr (adjustedDeadline )
@@ -959,7 +953,6 @@ func (c *Conn) readOffset(t int64) (offset int64, err error) {
959
953
// connection. If there are none, the method fetches all partitions of the kafka
960
954
// cluster.
961
955
func (c * Conn ) ReadPartitions (topics ... string ) (partitions []Partition , err error ) {
962
-
963
956
if len (topics ) == 0 {
964
957
if len (c .topic ) != 0 {
965
958
defaultTopics := [... ]string {c .topic }
@@ -1188,7 +1181,6 @@ func (c *Conn) writeCompressedMessages(codec CompressionCodec, msgs ...Message)
1188
1181
}
1189
1182
return size , err
1190
1183
}
1191
-
1192
1184
})
1193
1185
if err != nil {
1194
1186
return size , err
@@ -1556,7 +1548,7 @@ func (c *Conn) saslAuthenticate(data []byte) ([]byte, error) {
1556
1548
return nil , err
1557
1549
}
1558
1550
if version == v1 {
1559
- var request = saslAuthenticateRequestV0 {Data : data }
1551
+ request : = saslAuthenticateRequestV0 {Data : data }
1560
1552
var response saslAuthenticateResponseV0
1561
1553
1562
1554
err := c .writeOperation (
0 commit comments