Skip to content

Commit 03b7219

Browse files
committed
fix: use make for updated consumer row
1 parent 33ee88b commit 03b7219

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/cmd/kafka/consumergroup/resetoffset/reset_offset.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,16 +238,16 @@ func runCmd(opts *Options) error {
238238
}
239239

240240
func mapResetOffsetResultToTableFormat(consumers []kafkainstanceclient.ConsumerGroupResetOffsetResultItem) []updatedConsumerRow {
241-
rows := []updatedConsumerRow{}
241+
rows := make([]updatedConsumerRow, len(consumers))
242242

243-
for _, t := range consumers {
243+
for i, t := range consumers {
244244

245245
row := updatedConsumerRow{
246246
Topic: t.GetTopic(),
247247
Partition: t.GetPartition(),
248248
Offset: t.GetOffset(),
249249
}
250-
rows = append(rows, row)
250+
rows[i] = row
251251
}
252252

253253
return rows

0 commit comments

Comments
 (0)