github-vet / github-vet/rangeloop-pointer-findings
selinplus/go-dingtalk: routers/api/fsdj/highlight.go; 14 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [selinplus/go-dingtalk](https://www.github.com/selinplus/go-dingtalk) at [routers/api/fsdj/highlight.go](https://github.com/selinplus/go-dingtalk/blob/87146958b269c7f9e1eb6198fb6f6efc1ebdf579/routers/api/fsdj/highlight.go#L319-L332)
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.
> reference to star was used in a composite literal at line 327
[Click here to see the code in its original context.](https://github.com/selinplus/go-dingtalk/blob/87146958b269c7f9e1eb6198fb6f6efc1ebdf579/routers/api/fsdj/highlight.go#L319-L332)
Click here to show the 14 line(s) of Go which triggered the analyzer.
```go
for _, star := range hlt.StudyHltStars {
user, err := models.GetUserdemoByUserid(star.UserID)
if err != nil {
appG.Response(http.StatusInternalServerError, e.ERROR_GET_USER_FAIL,
fmt.Sprintf("根据userid:%s 获取人员信息错误:%v", star.UserID, err))
return
}
stars = append(stars, &HltStarResp{
StudyHltStar: &star,
Avatar: user.Avatar,
Name: user.Name,
Mobile: user.Mobile,
})
}
```
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: 87146958b269c7f9e1eb6198fb6f6efc1ebdf579
Contributor guide
No contributing guide indexed for this repository
Research direction
Start at routers/api/fsdj/highlight.go lines 319-332 in commit 87146958b269c7f9e1eb6198fb6f6efc1ebdf579 and inspect the surrounding handler and range over StudyHltStars. Verify the analyzer's pointer-to-range-variable finding, then classify the report as Bug, Mitigated, or Desirable Behavior using the requested issue reaction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100