Skip to content

Commit

Permalink
Fix golint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
milindl committed Oct 17, 2023
1 parent a07f393 commit c97ee8b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion examples/admin_describe_cluster/admin_describe_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func main() {

// Print results
fmt.Printf("ClusterId: %s\nController: %s\nNodes: %s\n",
clusterDesc.ClusterId, clusterDesc.Controller, clusterDesc.Nodes)
clusterDesc.ClusterID, clusterDesc.Controller, clusterDesc.Nodes)
if include_authorized_operations {
fmt.Printf("Allowed operations: %s\n", clusterDesc.AuthorizedOperations)
}
Expand Down
15 changes: 8 additions & 7 deletions kafka/adminapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ func NewTopicCollectionOfTopicNames(names []string) TopicCollection {
}
}

// Topic Partition information
// TopicPartitionInfo represents a specific partition's information inside a
// TopicDescription.
type TopicPartitionInfo struct {
// Partition id.
Partition int
Expand Down Expand Up @@ -350,7 +351,7 @@ type DescribeTopicsResult struct {
// DescribeClusterResult represents the result of DescribeCluster.
type DescribeClusterResult struct {
// Cluster id for the cluster.
ClusterId string
ClusterID string
// Current controller broker for the cluster.
Controller *Node
// List of brokers in the cluster.
Expand Down Expand Up @@ -1108,8 +1109,8 @@ func (a *AdminClient) cToNode(cNode *C.rd_kafka_Node_t) Node {

cRack := C.rd_kafka_Node_rack(cNode)
if cRack != nil {
rackId := C.GoString(cRack)
node.Rack = &rackId
rackID := C.GoString(cRack)
node.Rack = &rackID
}

return node
Expand Down Expand Up @@ -1212,9 +1213,9 @@ func (a *AdminClient) cToConsumerGroupDescriptions(
// TopicPartitionInfo.
func (a *AdminClient) cToTopicPartitionInfo(
partitionInfo *C.rd_kafka_TopicPartitionInfo_t) TopicPartitionInfo {
cPartitionId := C.rd_kafka_TopicPartitionInfo_partition(partitionInfo)
cPartitionID := C.rd_kafka_TopicPartitionInfo_partition(partitionInfo)
info := TopicPartitionInfo{
Partition: int(cPartitionId),
Partition: int(cPartitionID),
}

cLeader := C.rd_kafka_TopicPartitionInfo_leader(partitionInfo)
Expand Down Expand Up @@ -1302,7 +1303,7 @@ func (a *AdminClient) cToDescribeClusterResult(
cAuthorizedOperations, cAuthorizedOperationsCnt)

return DescribeClusterResult{
ClusterId: clusterID,
ClusterID: clusterID,
Controller: controller,
Nodes: nodes,
AuthorizedOperations: authorizedOperations,
Expand Down
6 changes: 3 additions & 3 deletions kafka/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1269,7 +1269,7 @@ func (its *IntegrationTestSuite) TestAdminClient_DescribeCluster() {
// of the cluster ID. We try checking for the existence in cases we can.
assert.Nil(err, "DescribeCluster should not throw an error")
assert.NotEmpty(descres.Nodes, "Cluster nodes should not be empty")
assert.NotEmpty(descres.ClusterId, "Cluster id should be set")
assert.NotEmpty(descres.ClusterID, "Cluster id should be set")
assert.NotEmpty(descres.Nodes[0].Host,
"First node's host should be non-empty")
assert.Empty(descres.AuthorizedOperations,
Expand All @@ -1290,7 +1290,7 @@ func (its *IntegrationTestSuite) TestAdminClient_DescribeCluster() {

assert.Nil(err, "DescribeCluster should not throw an error")
assert.NotEmpty(descres.Nodes, "Cluster nodes should not be empty")
assert.NotEmpty(descres.ClusterId, "Cluster id should be set")
assert.NotEmpty(descres.ClusterID, "Cluster id should be set")
assert.NotEmpty(descres.Nodes[0].Host,
"First node's host should be non-empty")
assert.NotEmpty(descres.AuthorizedOperations,
Expand Down Expand Up @@ -1355,7 +1355,7 @@ func (its *IntegrationTestSuite) TestAdminClient_DescribeCluster() {

assert.Nil(err, "DescribeCluster should not throw an error")
assert.NotEmpty(descres.Nodes, "Cluster nodes should not be empty")
assert.NotEmpty(descres.ClusterId, "Cluster id should be set")
assert.NotEmpty(descres.ClusterID, "Cluster id should be set")
assert.NotEmpty(descres.Nodes[0].Host,
"First node's host should be non-empty")
assert.NotEmpty(descres.AuthorizedOperations,
Expand Down

0 comments on commit c97ee8b

Please sign in to comment.