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 15, 2020
1 parent 17da3b6 commit 6140ed5
Show file tree
Hide file tree
Showing 35 changed files with 357 additions and 407 deletions.
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
9 changes: 0 additions & 9 deletions admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ func (ca *clusterAdmin) Controller() (*Broker, error) {
}

func (ca *clusterAdmin) CreateTopic(topic string, detail *TopicDetail, validateOnly bool) error {

if topic == "" {
return ErrInvalidTopic
}
Expand Down Expand Up @@ -308,7 +307,6 @@ func (ca *clusterAdmin) ListTopics() (map[string]TopicDetail, error) {
}

func (ca *clusterAdmin) DeleteTopic(topic string) error {

if topic == "" {
return ErrInvalidTopic
}
Expand Down Expand Up @@ -379,7 +377,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 @@ -433,7 +430,6 @@ func (ca *clusterAdmin) DeleteRecords(topic string, partitionOffsets map[int32]i
}

func (ca *clusterAdmin) DescribeConfig(resource ConfigResource) ([]ConfigEntry, error) {

var entries []ConfigEntry
var resources []*ConfigResource
resources = append(resources, &resource)
Expand Down Expand Up @@ -466,7 +462,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 @@ -518,7 +513,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 @@ -566,7 +560,6 @@ func (ca *clusterAdmin) DeleteACL(filter AclFilter, validateOnly bool) ([]Matchi
for _, mACL := range fr.MatchingAcls {
mAcls = append(mAcls, *mACL)
}

}
return mAcls, nil
}
Expand All @@ -580,7 +573,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 @@ -623,7 +615,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 @@ -821,7 +821,6 @@ func TestListConsumerGroups(t *testing.T) {
if err != nil {
t.Fatal(err)
}

}

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

}

func TestListConsumerGroupOffsets(t *testing.T) {
Expand Down Expand Up @@ -915,7 +913,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 @@ -934,7 +932,6 @@ func TestListConsumerGroupOffsets(t *testing.T) {
if err != nil {
t.Fatal(err)
}

}

func TestDeleteConsumerGroup(t *testing.T) {
Expand Down Expand Up @@ -964,5 +961,4 @@ func TestDeleteConsumerGroup(t *testing.T) {
if err != nil {
t.Fatalf("DeleteConsumerGroup failed with error %v", err)
}

}
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 6140ed5

Please sign in to comment.