Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
bai committed Jan 26, 2020
1 parent 7bb6ac1 commit 4cf1ede
Show file tree
Hide file tree
Showing 38 changed files with 415 additions and 445 deletions.
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ linters-settings:
golint:
min-confidence: 0
gocyclo:
min-complexity: 95
min-complexity: 99
maligned:
suggest-new: true
dupl:
Expand Down
2 changes: 1 addition & 1 deletion add_partitions_to_txn_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestAddPartitionsToTxnRequest(t *testing.T) {
ProducerID: 8000,
ProducerEpoch: 0,
TopicPartitions: map[string][]int32{
"topic": []int32{1},
"topic": {1},
},
}

Expand Down
2 changes: 1 addition & 1 deletion add_partitions_to_txn_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func TestAddPartitionsToTxnResponse(t *testing.T) {
resp := &AddPartitionsToTxnResponse{
ThrottleTime: 100 * time.Millisecond,
Errors: map[string][]*PartitionError{
"topic": []*PartitionError{&PartitionError{
"topic": {{
Err: ErrInvalidTxnState,
Partition: 2,
}},
Expand Down
6 changes: 0 additions & 6 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,6 @@ func (ca *clusterAdmin) CreatePartitions(topic string, count int32, assignment [
}

func (ca *clusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]int64) error {

if topic == "" {
return ErrInvalidTopic
}
Expand Down Expand Up @@ -557,7 +556,6 @@ func (ca *clusterAdmin) DescribeConfig(resource ConfigResource) ([]ConfigEntry,
}

func (ca *clusterAdmin) AlterConfig(resourceType ConfigResourceType, name string, entries map[string]*string, validateOnly bool) error {

var resources []*AlterConfigsResource
resources = append(resources, &AlterConfigsResource{
Type: resourceType,
Expand Down Expand Up @@ -621,7 +619,6 @@ func (ca *clusterAdmin) CreateACL(resource Resource, acl Acl) error {
}

func (ca *clusterAdmin) ListAcls(filter AclFilter) ([]ResourceAcls, error) {

request := &DescribeAclsRequest{AclFilter: filter}

if ca.conf.Version.IsAtLeast(V2_0_0_0) {
Expand Down Expand Up @@ -669,7 +666,6 @@ func (ca *clusterAdmin) DeleteACL(filter AclFilter, validateOnly bool) ([]Matchi
for _, mACL := range fr.MatchingAcls {
mAcls = append(mAcls, *mACL)
}

}
return mAcls, nil
}
Expand All @@ -683,7 +679,6 @@ func (ca *clusterAdmin) DescribeConsumerGroups(groups []string) (result []*Group
return nil, err
}
groupsPerBroker[controller] = append(groupsPerBroker[controller], group)

}

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

groupMaps <- groups

}(b, ca.conf)
}

Expand Down
6 changes: 1 addition & 5 deletions admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,6 @@ func TestListConsumerGroups(t *testing.T) {
if err != nil {
t.Fatal(err)
}

}

func TestListConsumerGroupsMultiBroker(t *testing.T) {
Expand Down Expand Up @@ -1024,7 +1023,6 @@ func TestListConsumerGroupsMultiBroker(t *testing.T) {
if err != nil {
t.Fatal(err)
}

}

func TestListConsumerGroupOffsets(t *testing.T) {
Expand Down Expand Up @@ -1053,7 +1051,7 @@ func TestListConsumerGroupOffsets(t *testing.T) {
}

response, err := admin.ListConsumerGroupOffsets(group, map[string][]int32{
topic: []int32{0},
topic: {0},
})
if err != nil {
t.Fatalf("ListConsumerGroupOffsets failed with error %v", err)
Expand All @@ -1072,7 +1070,6 @@ func TestListConsumerGroupOffsets(t *testing.T) {
if err != nil {
t.Fatal(err)
}

}

func TestDeleteConsumerGroup(t *testing.T) {
Expand Down Expand Up @@ -1102,7 +1099,6 @@ func TestDeleteConsumerGroup(t *testing.T) {
if err != nil {
t.Fatalf("DeleteConsumerGroup failed with error %v", err)
}

}

// TestRefreshMetaDataWithDifferentController ensures that the cached
Expand Down
6 changes: 3 additions & 3 deletions alter_configs_request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestAlterConfigsRequest(t *testing.T) {
configValue := "1000"
request = &AlterConfigsRequest{
Resources: []*AlterConfigsResource{
&AlterConfigsResource{
{
Type: TopicResource,
Name: "foo",
ConfigEntries: map[string]*string{
Expand All @@ -65,14 +65,14 @@ func TestAlterConfigsRequest(t *testing.T) {

request = &AlterConfigsRequest{
Resources: []*AlterConfigsResource{
&AlterConfigsResource{
{
Type: TopicResource,
Name: "foo",
ConfigEntries: map[string]*string{
"segment.ms": &configValue,
},
},
&AlterConfigsResource{
{
Type: TopicResource,
Name: "bar",
ConfigEntries: map[string]*string{
Expand Down
2 changes: 1 addition & 1 deletion alter_configs_response_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestAlterConfigsResponse(t *testing.T) {

response = &AlterConfigsResponse{
Resources: []*AlterConfigsResourceResponse{
&AlterConfigsResourceResponse{
{
ErrorCode: 0,
ErrorMsg: "",
Type: TopicResource,
Expand Down
1 change: 0 additions & 1 deletion async_producer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,6 @@ func (l *testLogger) Println(v ...interface{}) {
}

func TestAsyncProducerRecoveryWithRetriesDisabled(t *testing.T) {

tt := func(t *testing.T, kErr KError) {
seedBroker := NewMockBroker(t, 1)
leader1 := NewMockBroker(t, 2)
Expand Down
Loading

0 comments on commit 4cf1ede

Please sign in to comment.