github-vet / github-vet/rangeloop-pointer-findings
onurkeskin/idletownsim: map/MapCreation.go; 11 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [onurkeskin/idletownsim](https://www.github.com/onurkeskin/idletownsim) at [map/MapCreation.go](https://github.com/onurkeskin/idletownsim/blob/0d41b7304f88bd5a043097a0d8a411e75d4ce789/map/MapCreation.go#L44-L54)
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 v is reassigned at line 50
[Click here to see the code in its original context.](https://github.com/onurkeskin/idletownsim/blob/0d41b7304f88bd5a043097a0d8a411e75d4ce789/map/MapCreation.go#L44-L54)
Click here to show the 11 line(s) of Go which triggered the analyzer.
```go
for _, v := range possibilities {
cLat := v.MapFundamentalCoordinates.Lat
cLng := v.MapFundamentalCoordinates.Lng
//dist := math.Acos(math.Sin(cLat))*math.Sin(convertDegreesToRad(cLng)) + math.Cos(cLat)*math.Cos(convertDegreesToRad(cLat)*math.Cos(convertDegreesToRad(cLng)))
dist := getDistanceFromLatLonInKm(cLat, cLng, pos.Lat, pos.Lng)
if dist < BestDist && dist < radiusOfCircleKm {
curBest = &v
BestDist = dist
found = true
}
}
```
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: 0d41b7304f88bd5a043097a0d8a411e75d4ce789
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.