github-vet / github-vet/rangeloop-pointer-findings
onurkeskin/idletownsim: game/serverlayer/building/BuildingMapper.go; 3 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 [game/serverlayer/building/BuildingMapper.go](https://github.com/onurkeskin/idletownsim/blob/0d41b7304f88bd5a043097a0d8a411e75d4ce789/game/serverlayer/building/BuildingMapper.go#L96-L98)
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 97
[Click here to see the code in its original context.](https://github.com/onurkeskin/idletownsim/blob/0d41b7304f88bd5a043097a0d8a411e75d4ce789/game/serverlayer/building/BuildingMapper.go#L96-L98)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for _, v := range builsDB {
r.mapped[v.ID.Hex()] = &v
}
```
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
Research direction
Read game/serverlayer/building/BuildingMapper.go around lines 96-98 and inspect how the mapped building references are used. Confirm the analyzer's range-loop finding in the repository context, then run the available Go tests or add focused coverage; the issue is done when the mapping behavior is correct and the finding is addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100