github-vet / github-vet/rangeloop-pointer-findings
jeroenrinzema/commander: dialects/kafka/consumer/partition.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [jeroenrinzema/commander](https://www.github.com/jeroenrinzema/commander) at [dialects/kafka/consumer/partition.go](https://github.com/jeroenrinzema/commander/blob/8b75010b786bc2c1cb8d95b531e400c480bef6d2/dialects/kafka/consumer/partition.go#L212-L222)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> range-loop variable topic used in defer or goroutine at line 218
[Click here to see the code in its original context.](https://github.com/jeroenrinzema/commander/blob/8b75010b786bc2c1cb8d95b531e400c480bef6d2/dialects/kafka/consumer/partition.go#L212-L222)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, topic := range handle.partitions {
for _, partition := range topic.consumers {
wg.Add(1)
go func(partition *PartitionConsumer) {
partition.closing = true
partition.client.Close()
topic.Delist(partition)
wg.Done()
}(partition)
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 8b75010b786bc2c1cb8d95b531e400c480bef6d2
Contributor guide
No contributing guide indexed for this repository
Research direction
Read dialects/kafka/consumer/partition.go around lines 212-222 and inspect how the topic range variable is used by the goroutine at line 218. Determine whether the analyzer finding can affect which consumer is passed to Delist; done means classifying the finding as a bug, mitigated issue, or desirable behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- stream-processing
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100