diff --git a/examples/admin_describe_cluster/admin_describe_cluster.go b/examples/admin_describe_cluster/admin_describe_cluster.go index 79bcf78c6..71561a625 100644 --- a/examples/admin_describe_cluster/admin_describe_cluster.go +++ b/examples/admin_describe_cluster/admin_describe_cluster.go @@ -31,17 +31,17 @@ func main() { if len(os.Args) < 3 { fmt.Fprintf( os.Stderr, - "Usage: %s \n", + "Usage: %s \n", os.Args[0]) os.Exit(1) } bootstrapServers := os.Args[1] - include_authorized_operations, err_operations := strconv.ParseBool(os.Args[2]) - if err_operations != nil { + includeAuthorizedOperations, errOperations := strconv.ParseBool(os.Args[2]) + if errOperations != nil { fmt.Printf( - "Failed to parse value of include_authorized_operations %s: %s\n", - os.Args[2], err_operations) + "Failed to parse value of includeAuthorizedOperations %s: %s\n", + os.Args[2], errOperations) os.Exit(1) } @@ -60,7 +60,7 @@ func main() { defer cancel() clusterDesc, err := a.DescribeCluster( ctx, kafka.SetAdminOptionIncludeAuthorizedOperations( - include_authorized_operations)) + includeAuthorizedOperations)) if err != nil { fmt.Printf("Failed to describe cluster: %s\n", err) os.Exit(1) @@ -68,8 +68,8 @@ func main() { // Print results fmt.Printf("ClusterId: %s\nController: %s\nNodes: %s\n", - clusterDesc.ClusterId, clusterDesc.Controller, clusterDesc.Nodes) - if include_authorized_operations { + clusterDesc.ClusterID, clusterDesc.Controller, clusterDesc.Nodes) + if includeAuthorizedOperations { fmt.Printf("Allowed operations: %s\n", clusterDesc.AuthorizedOperations) } } diff --git a/examples/admin_describe_consumer_groups/admin_describe_consumer_groups.go b/examples/admin_describe_consumer_groups/admin_describe_consumer_groups.go index 18adb66ce..a16af9315 100644 --- a/examples/admin_describe_consumer_groups/admin_describe_consumer_groups.go +++ b/examples/admin_describe_consumer_groups/admin_describe_consumer_groups.go @@ -31,17 +31,17 @@ func main() { if len(os.Args) < 4 { fmt.Fprintf( os.Stderr, - "Usage: %s "+ + "Usage: %s "+ " [ ...]\n", os.Args[0]) os.Exit(1) } bootstrapServers := os.Args[1] - include_authorized_operations, err_operations := strconv.ParseBool(os.Args[2]) - if err_operations != nil { + includeAuthorizedOperations, errOperations := strconv.ParseBool(os.Args[2]) + if errOperations != nil { fmt.Printf( - "Failed to parse value of include_authorized_operations %s: %s\n", os.Args[2], err_operations) + "Failed to parse value of includeAuthorizedOperations %s: %s\n", os.Args[2], errOperations) os.Exit(1) } @@ -61,7 +61,7 @@ func main() { ctx, cancel := context.WithTimeout(context.Background(), time.Second*30) defer cancel() describeGroupsResult, err := a.DescribeConsumerGroups(ctx, groups, - kafka.SetAdminOptionIncludeAuthorizedOperations(include_authorized_operations)) + kafka.SetAdminOptionIncludeAuthorizedOperations(includeAuthorizedOperations)) if err != nil { fmt.Printf("Failed to describe groups: %s\n", err) os.Exit(1) @@ -80,7 +80,7 @@ func main() { "Members: %+v\n", g.GroupID, g.Error, g.IsSimpleConsumerGroup, g.PartitionAssignor, g.State, g.Coordinator, g.Members) - if include_authorized_operations { + if includeAuthorizedOperations { fmt.Printf("Allowed operations: %s\n", g.AuthorizedOperations) } fmt.Printf("\n") diff --git a/examples/admin_describe_topics/admin_describe_topics.go b/examples/admin_describe_topics/admin_describe_topics.go index b1e2aef08..7cffba19e 100644 --- a/examples/admin_describe_topics/admin_describe_topics.go +++ b/examples/admin_describe_topics/admin_describe_topics.go @@ -31,18 +31,18 @@ func main() { if len(os.Args) < 4 { fmt.Fprintf( os.Stderr, - "Usage: %s "+ + "Usage: %s "+ " [ ...]\n", os.Args[0]) os.Exit(1) } bootstrapServers := os.Args[1] - include_authorized_operations, err_operations := strconv.ParseBool(os.Args[2]) - if err_operations != nil { + includeAuthorizedOperations, errOperations := strconv.ParseBool(os.Args[2]) + if errOperations != nil { fmt.Printf( - "Failed to parse value of include_authorized_operations %s: %s\n", - os.Args[2], err_operations) + "Failed to parse value of includeAuthorizedOperations %s: %s\n", + os.Args[2], errOperations) os.Exit(1) } topics := os.Args[3:] @@ -63,7 +63,7 @@ func main() { describeTopicsResult, err := a.DescribeTopics( ctx, kafka.NewTopicCollectionOfTopicNames(topics), kafka.SetAdminOptionIncludeAuthorizedOperations( - include_authorized_operations)) + includeAuthorizedOperations)) if err != nil { fmt.Printf("Failed to describe topics: %s\n", err) os.Exit(1) @@ -79,7 +79,7 @@ func main() { continue } fmt.Printf("Topic: %s has succeeded\n", t.Name) - if include_authorized_operations { + if includeAuthorizedOperations { fmt.Printf("Allowed operations: %s\n", t.AuthorizedOperations) } for i := 0; i < len(t.Partitions); i++ { diff --git a/kafka/adminapi.go b/kafka/adminapi.go index 0878e1fe3..b785afeb9 100644 --- a/kafka/adminapi.go +++ b/kafka/adminapi.go @@ -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 @@ -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. @@ -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 @@ -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) @@ -1302,7 +1303,7 @@ func (a *AdminClient) cToDescribeClusterResult( cAuthorizedOperations, cAuthorizedOperationsCnt) return DescribeClusterResult{ - ClusterId: clusterID, + ClusterID: clusterID, Controller: controller, Nodes: nodes, AuthorizedOperations: authorizedOperations, diff --git a/kafka/integration_test.go b/kafka/integration_test.go index 8ed26fe4d..783ad9481 100644 --- a/kafka/integration_test.go +++ b/kafka/integration_test.go @@ -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, @@ -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, @@ -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,