github-vet / github-vet/rangeloop-pointer-findings
yucendulang/DragaliaLostQQBot: plugin/plugin.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yucendulang/DragaliaLostQQBot](https://www.github.com/yucendulang/DragaliaLostQQBot) at [plugin/plugin.go](https://github.com/yucendulang/DragaliaLostQQBot/blob/99de18886319d163a6988af77eea0e9c6b69a4ff/plugin/plugin.go#L109-L128)
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 res used in defer or goroutine at line 124
[Click here to see the code in its original context.](https://github.com/yucendulang/DragaliaLostQQBot/blob/99de18886319d163a6988af77eea0e9c6b69a4ff/plugin/plugin.go#L109-L128)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, res := range resList {
if res.PicUrl != "" {
//model.SendPic(data.FromGroupID, sendToType, res.Content, res.PicUrl)
fn(res.Content, res.PicUrl)
} else if res.Pic != nil {
url := printShuiYin(res, req)
//model.SendPic(data.FromGroupID, sendToType, res.Content, url)
fn(res.Content, url)
} else if res.Content != "" {
//model.Send(data.FromGroupID, sendToType, res.Content)
fn(res.Content, "")
}
if res.DelayFunc != nil {
go func() {
fmt.Printf("enter DelayFunc")
outStr := res.DelayFunc()
fn(outStr, "")
}()
}
}
```
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: 99de18886319d163a6988af77eea0e9c6b69a4ff
Contributor guide
No contributing guide indexed for this repository
Research direction
Read plugin/plugin.go lines 109-128 at commit 99de18886319d163a6988af77eea0e9c6b69a4ff, focusing on the reported range-loop variable use in the goroutine. Decide whether the analyzer finding is a Bug, Mitigated, or Desirable Behavior, then leave the corresponding reaction on issue #16104.
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
- 45/100