github-vet / github-vet/rangeloop-pointer-findings
caTUstrophy/backend: matching-algorithm.go; 25 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [caTUstrophy/backend](https://www.github.com/caTUstrophy/backend) at [matching-algorithm.go](https://github.com/caTUstrophy/backend/blob/0ca9a5c5a1829a775b83296e34332b504be10bc2/matching-algorithm.go#L239-L263)
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.
>
[Click here to see the code in its original context.](https://github.com/caTUstrophy/backend/blob/0ca9a5c5a1829a775b83296e34332b504be10bc2/matching-algorithm.go#L239-L263)
Click here to show the 25 line(s) of Go which triggered the analyzer.
```go
for _, Region := range request.Regions {
// Load all offers in this region that are
// - not yet expired
// - and not yet matched.
app.DB.Preload("Offers", "\"offers\".\"expired\" = ? AND \"offers\".\"matched\" = ?", false, false).First(&Region)
// Preload needed tags.
app.DB.Preload("Tags").Find(&Region.Offers)
for _, offer := range Region.Offers {
// Calculate pair-wise matching score between
// request and all reasonable offers in region.
go app.CalculateMatchingScore(calcDone, Region, offer, request)
}
// Wait for all goroutines to finish.
for u := 0; u < len(Region.Offers); u++ {
_ = <-calcDone
}
// Tell database that region has an updated recommendation calculation.
app.DB.Model(&Region).Select("recommendation_updated").Update("RecommendationUpdated", false)
}
```
Click here to show extra information the analyzer produced.
```
No path was found through the callgraph that could lead to a function which writes a pointer argument.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {First 1} was not found in the callgraph; reference was passed directly to third-party code
```
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: 0ca9a5c5a1829a775b83296e34332b504be10bc2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.