Skip to content

Commit a473679

Browse files
author
Achille
authored
fix formatting + require Go 1.15 (#749)
1 parent df148e4 commit a473679

File tree

10 files changed

+29
-28
lines changed

10 files changed

+29
-28
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ some features available from the Kafka API may not be implemented yet.
7171

7272
## Golang version
7373

74-
`kafka-go` is currently compatible with golang version from 1.13+. To use with older versions of golang use release [v0.2.5](https://github.com/segmentio/kafka-go/releases/tag/v0.2.5).
74+
`kafka-go` is currently compatible with golang version from 1.15+. To use with older versions of golang use release [v0.2.5](https://github.com/segmentio/kafka-go/releases/tag/v0.2.5).
7575

7676
## Connection [![GoDoc](https://godoc.org/github.com/segmentio/kafka-go?status.svg)](https://godoc.org/github.com/segmentio/kafka-go#Conn)
7777

createpartitions_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ func TestClientCreatePartitions(t *testing.T) {
2121

2222
res, err := client.CreatePartitions(context.Background(), &CreatePartitionsRequest{
2323
Topics: []TopicPartitionsConfig{
24-
TopicPartitionsConfig{
24+
{
2525
Name: topic,
2626
Count: 2,
2727
TopicPartitionAssignments: []TopicPartitionAssignment{
28-
TopicPartitionAssignment{
28+
{
2929
BrokerIDs: []int32{1},
3030
},
3131
},

fetch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (c *Client) Fetch(ctx context.Context, req *FetchRequest) (*FetchResponse,
101101
r, err := c.ListOffsets(ctx, &ListOffsetsRequest{
102102
Addr: req.Addr,
103103
Topics: map[string][]OffsetRequest{
104-
topic: []OffsetRequest{{
104+
topic: {{
105105
Partition: partition,
106106
Timestamp: offset,
107107
}},

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/segmentio/kafka-go
22

3-
go 1.13
3+
go 1.15
44

55
require (
66
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21

protocol/reflect.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !unsafe
12
// +build !unsafe
23

34
package protocol

protocol/reflect_unsafe.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build unsafe
12
// +build unsafe
23

34
package protocol

read_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ type VarIntTestCase struct {
1717

1818
func TestReadVarInt(t *testing.T) {
1919
testCases := []*VarIntTestCase{
20-
&VarIntTestCase{v: 0, r: 3, tc: []byte{0, 1, 10, 0}},
21-
&VarIntTestCase{v: -1, r: 3, tc: []byte{1, 1, 10, 0}},
22-
&VarIntTestCase{v: 1, r: 3, tc: []byte{2, 1, 10, 0}},
23-
&VarIntTestCase{v: -2, r: 3, tc: []byte{3, 1, 10, 0}},
24-
&VarIntTestCase{v: 2, r: 3, tc: []byte{4, 1, 10, 0}},
25-
&VarIntTestCase{v: 64, r: 2, tc: []byte{128, 1, 10, 0}},
26-
&VarIntTestCase{v: -64, r: 3, tc: []byte{127, 1, 10, 0}},
27-
&VarIntTestCase{v: -196, r: 2, tc: []byte{135, 3, 10, 0}},
28-
&VarIntTestCase{v: -24772, r: 1, tc: []byte{135, 131, 3, 0}},
20+
{v: 0, r: 3, tc: []byte{0, 1, 10, 0}},
21+
{v: -1, r: 3, tc: []byte{1, 1, 10, 0}},
22+
{v: 1, r: 3, tc: []byte{2, 1, 10, 0}},
23+
{v: -2, r: 3, tc: []byte{3, 1, 10, 0}},
24+
{v: 2, r: 3, tc: []byte{4, 1, 10, 0}},
25+
{v: 64, r: 2, tc: []byte{128, 1, 10, 0}},
26+
{v: -64, r: 3, tc: []byte{127, 1, 10, 0}},
27+
{v: -196, r: 2, tc: []byte{135, 3, 10, 0}},
28+
{v: -24772, r: 1, tc: []byte{135, 131, 3, 0}},
2929
}
3030

3131
for _, tc := range testCases {

reader_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,6 @@ func createTopic(t *testing.T, topic string, partitions int) {
311311
t.FailNow()
312312
}
313313

314-
315314
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
316315
defer cancel()
317316

write_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ type WriteVarIntTestCase struct {
2525

2626
func TestWriteVarInt(t *testing.T) {
2727
testCases := []*WriteVarIntTestCase{
28-
&WriteVarIntTestCase{v: []byte{0}, tc: 0},
29-
&WriteVarIntTestCase{v: []byte{2}, tc: 1},
30-
&WriteVarIntTestCase{v: []byte{1}, tc: -1},
31-
&WriteVarIntTestCase{v: []byte{3}, tc: -2},
32-
&WriteVarIntTestCase{v: []byte{128, 2}, tc: 128},
33-
&WriteVarIntTestCase{v: []byte{254, 1}, tc: 127},
34-
&WriteVarIntTestCase{v: []byte{142, 6}, tc: 391},
35-
&WriteVarIntTestCase{v: []byte{142, 134, 6}, tc: 49543},
28+
{v: []byte{0}, tc: 0},
29+
{v: []byte{2}, tc: 1},
30+
{v: []byte{1}, tc: -1},
31+
{v: []byte{3}, tc: -2},
32+
{v: []byte{128, 2}, tc: 128},
33+
{v: []byte{254, 1}, tc: 127},
34+
{v: []byte{142, 6}, tc: 391},
35+
{v: []byte{142, 134, 6}, tc: 49543},
3636
}
3737

3838
for _, tc := range testCases {
@@ -203,7 +203,7 @@ func TestWriteV2RecordBatch(t *testing.T) {
203203
msgs := make([]Message, 15)
204204
for i := range msgs {
205205
value := fmt.Sprintf("Sample message content: %d!", i)
206-
msgs[i] = Message{Key: []byte("Key"), Value: []byte(value), Headers: []Header{Header{Key: "hk", Value: []byte("hv")}}}
206+
msgs[i] = Message{Key: []byte("Key"), Value: []byte(value), Headers: []Header{{Key: "hk", Value: []byte("hv")}}}
207207
}
208208

209209
w := &Writer{

writer_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,8 @@ func testWriterBatchSize(t *testing.T) {
486486
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
487487
defer cancel()
488488
if err := w.WriteMessages(ctx, []Message{
489-
Message{Value: []byte("Hi")}, // 24 Bytes
490-
Message{Value: []byte("By")}, // 24 Bytes
489+
{Value: []byte("Hi")}, // 24 Bytes
490+
{Value: []byte("By")}, // 24 Bytes
491491
}...); err != nil {
492492
t.Error(err)
493493
return
@@ -537,8 +537,8 @@ func testWriterSmallBatchBytes(t *testing.T) {
537537
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
538538
defer cancel()
539539
if err := w.WriteMessages(ctx, []Message{
540-
Message{Value: []byte("Hi")}, // 24 Bytes
541-
Message{Value: []byte("By")}, // 24 Bytes
540+
{Value: []byte("Hi")}, // 24 Bytes
541+
{Value: []byte("By")}, // 24 Bytes
542542
}...); err != nil {
543543
t.Error(err)
544544
return

0 commit comments

Comments
 (0)