github-vet / github-vet/rangeloop-pointer-findings
2SE/dolphin: core/dispatcher/dispatcher.go; 17 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [2SE/dolphin](https://www.github.com/2SE/dolphin) at [core/dispatcher/dispatcher.go](https://github.com/2SE/dolphin/blob/9056f0ff6091531eca16e0133d707d586b4f00f0/core/dispatcher/dispatcher.go#L100-L116)
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 item used in defer or goroutine at line 111
[Click here to see the code in its original context.](https://github.com/2SE/dolphin/blob/9056f0ff6091531eca16e0133d707d586b4f00f0/core/dispatcher/dispatcher.go#L100-L116)
Click here to show the 17 line(s) of Go which triggered the analyzer.
```go
for _, item := range subs {
log.WithFields(log.Fields{
"hub sub": string(data.Key),
}).Info("key=>", string(data.Key))
go func() {
sub := &pb.ServerComResponse{
SubKey: data.Key,
SubVal: data.Val,
}
req, err := core.Marshal(sub)
if err == nil {
if _, err := item.Sub.Write(req); err != nil {
log.WithError(err).Error("publish: failed")
}
}
}()
}
```
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: 9056f0ff6091531eca16e0133d707d586b4f00f0
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.