github-vet / github-vet/rangeloop-pointer-findings
Anteoy/gtools: test/base/pagenet/foreach/main.go; 3 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Anteoy/gtools](https://www.github.com/Anteoy/gtools) at [test/base/pagenet/foreach/main.go](https://github.com/Anteoy/gtools/blob/d920e95dc750855c4d9c1c744064cfa6409f875e/test/base/pagenet/foreach/main.go#L20-L22)
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 stu is reassigned at line 21
[Click here to see the code in its original context.](https://github.com/Anteoy/gtools/blob/d920e95dc750855c4d9c1c744064cfa6409f875e/test/base/pagenet/foreach/main.go#L20-L22)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for _,stu := range stus {
m[stu.Name] = &stu
}
```
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: d920e95dc750855c4d9c1c744064cfa6409f875e
Contributor guide
No contributing guide indexed for this repository
Research direction
Read test/base/pagenet/foreach/main.go around lines 20–22 and inspect how the range variable stu is used when its address is stored in m. Compare that usage with the analyzer message about reassignment. Done means reacting with Bug, Mitigated, or Desirable Behavior based on the observed behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100