github-vet / github-vet/rangeloop-pointer-findings
Templum/rabbitmq-connector: pkg/subscriber/subscriber.go; 10 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Templum/rabbitmq-connector](https://www.github.com/Templum/rabbitmq-connector) at [pkg/subscriber/subscriber.go](https://github.com/Templum/rabbitmq-connector/blob/43976f802d876418170012a9ca597513a33a4edc/pkg/subscriber/subscriber.go#L69-L78)
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 invocation used in defer or goroutine at line 72
[Click here to see the code in its original context.](https://github.com/Templum/rabbitmq-connector/blob/43976f802d876418170012a9ca597513a33a4edc/pkg/subscriber/subscriber.go#L69-L78)
Click here to show the 10 line(s) of Go which triggered the analyzer.
```go
for invocation := range invocations {
if s.topic == invocation.Topic {
go func() {
s.client.Invoke(s.topic, invocation)
log.Printf("Finished invocations of functions on topic %s", s.topic)
}()
} else {
log.Printf("Should not happen, but subscriber topic - %s is not equals to invocation topic - %s", s.topic, invocation.Topic)
}
}
```
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: 43976f802d876418170012a9ca597513a33a4edc
Contributor guide
No contributing guide indexed for this repository
Research direction
Read pkg/subscriber/subscriber.go at lines 69-78 in the linked commit, focusing on the range variable captured by the goroutine. Compare the reported behavior with Go range-loop capture semantics and the analyzer guidance, then classify the finding by leaving the appropriate reaction on this issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100