Skip to content

Commit 07ff436

Browse files
committed
Fix linter errors
1 parent b8c5f7c commit 07ff436

36 files changed

+358
-405
lines changed

.golangci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ linters-settings:
88
golint:
99
min-confidence: 0
1010
gocyclo:
11-
min-complexity: 95
11+
min-complexity: 99
1212
maligned:
1313
suggest-new: true
1414
dupl:

add_partitions_to_txn_request_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func TestAddPartitionsToTxnRequest(t *testing.T) {
1919
ProducerID: 8000,
2020
ProducerEpoch: 0,
2121
TopicPartitions: map[string][]int32{
22-
"topic": []int32{1},
22+
"topic": {1},
2323
},
2424
}
2525

add_partitions_to_txn_response_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestAddPartitionsToTxnResponse(t *testing.T) {
2020
resp := &AddPartitionsToTxnResponse{
2121
ThrottleTime: 100 * time.Millisecond,
2222
Errors: map[string][]*PartitionError{
23-
"topic": []*PartitionError{&PartitionError{
23+
"topic": {{
2424
Err: ErrInvalidTxnState,
2525
Partition: 2,
2626
}},

admin.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ func (ca *clusterAdmin) CreatePartitions(topic string, count int32, assignment [
444444
}
445445

446446
func (ca *clusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]int64) error {
447-
448447
if topic == "" {
449448
return ErrInvalidTopic
450449
}
@@ -557,7 +556,6 @@ func (ca *clusterAdmin) DescribeConfig(resource ConfigResource) ([]ConfigEntry,
557556
}
558557

559558
func (ca *clusterAdmin) AlterConfig(resourceType ConfigResourceType, name string, entries map[string]*string, validateOnly bool) error {
560-
561559
var resources []*AlterConfigsResource
562560
resources = append(resources, &AlterConfigsResource{
563561
Type: resourceType,
@@ -621,7 +619,6 @@ func (ca *clusterAdmin) CreateACL(resource Resource, acl Acl) error {
621619
}
622620

623621
func (ca *clusterAdmin) ListAcls(filter AclFilter) ([]ResourceAcls, error) {
624-
625622
request := &DescribeAclsRequest{AclFilter: filter}
626623

627624
if ca.conf.Version.IsAtLeast(V2_0_0_0) {
@@ -669,7 +666,6 @@ func (ca *clusterAdmin) DeleteACL(filter AclFilter, validateOnly bool) ([]Matchi
669666
for _, mACL := range fr.MatchingAcls {
670667
mAcls = append(mAcls, *mACL)
671668
}
672-
673669
}
674670
return mAcls, nil
675671
}
@@ -683,7 +679,6 @@ func (ca *clusterAdmin) DescribeConsumerGroups(groups []string) (result []*Group
683679
return nil, err
684680
}
685681
groupsPerBroker[controller] = append(groupsPerBroker[controller], group)
686-
687682
}
688683

689684
for broker, brokerGroups := range groupsPerBroker {
@@ -726,7 +721,6 @@ func (ca *clusterAdmin) ListConsumerGroups() (allGroups map[string]string, err e
726721
}
727722

728723
groupMaps <- groups
729-
730724
}(b, ca.conf)
731725
}
732726

admin_test.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,6 @@ func TestListConsumerGroups(t *testing.T) {
959959
if err != nil {
960960
t.Fatal(err)
961961
}
962-
963962
}
964963

965964
func TestListConsumerGroupsMultiBroker(t *testing.T) {
@@ -1024,7 +1023,6 @@ func TestListConsumerGroupsMultiBroker(t *testing.T) {
10241023
if err != nil {
10251024
t.Fatal(err)
10261025
}
1027-
10281026
}
10291027

10301028
func TestListConsumerGroupOffsets(t *testing.T) {
@@ -1053,7 +1051,7 @@ func TestListConsumerGroupOffsets(t *testing.T) {
10531051
}
10541052

10551053
response, err := admin.ListConsumerGroupOffsets(group, map[string][]int32{
1056-
topic: []int32{0},
1054+
topic: {0},
10571055
})
10581056
if err != nil {
10591057
t.Fatalf("ListConsumerGroupOffsets failed with error %v", err)
@@ -1072,7 +1070,6 @@ func TestListConsumerGroupOffsets(t *testing.T) {
10721070
if err != nil {
10731071
t.Fatal(err)
10741072
}
1075-
10761073
}
10771074

10781075
func TestDeleteConsumerGroup(t *testing.T) {
@@ -1102,7 +1099,6 @@ func TestDeleteConsumerGroup(t *testing.T) {
11021099
if err != nil {
11031100
t.Fatalf("DeleteConsumerGroup failed with error %v", err)
11041101
}
1105-
11061102
}
11071103

11081104
// TestRefreshMetaDataWithDifferentController ensures that the cached

alter_configs_request_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestAlterConfigsRequest(t *testing.T) {
5151
configValue := "1000"
5252
request = &AlterConfigsRequest{
5353
Resources: []*AlterConfigsResource{
54-
&AlterConfigsResource{
54+
{
5555
Type: TopicResource,
5656
Name: "foo",
5757
ConfigEntries: map[string]*string{
@@ -65,14 +65,14 @@ func TestAlterConfigsRequest(t *testing.T) {
6565

6666
request = &AlterConfigsRequest{
6767
Resources: []*AlterConfigsResource{
68-
&AlterConfigsResource{
68+
{
6969
Type: TopicResource,
7070
Name: "foo",
7171
ConfigEntries: map[string]*string{
7272
"segment.ms": &configValue,
7373
},
7474
},
75-
&AlterConfigsResource{
75+
{
7676
Type: TopicResource,
7777
Name: "bar",
7878
ConfigEntries: map[string]*string{

alter_configs_response_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestAlterConfigsResponse(t *testing.T) {
3333

3434
response = &AlterConfigsResponse{
3535
Resources: []*AlterConfigsResourceResponse{
36-
&AlterConfigsResourceResponse{
36+
{
3737
ErrorCode: 0,
3838
ErrorMsg: "",
3939
Type: TopicResource,

async_producer_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@ func (l *testLogger) Println(v ...interface{}) {
328328
}
329329

330330
func TestAsyncProducerRecoveryWithRetriesDisabled(t *testing.T) {
331-
332331
tt := func(t *testing.T, kErr KError) {
333332
seedBroker := NewMockBroker(t, 1)
334333
leader1 := NewMockBroker(t, 2)

0 commit comments

Comments
 (0)