github-vet / github-vet/rangeloop-pointer-findings
streetbyters/forgolang_forum: api/api.go; 7 LoC
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [streetbyters/forgolang_forum](https://www.github.com/streetbyters/forgolang_forum) at [api/api.go](https://github.com/streetbyters/forgolang_forum/blob/d6faf7a6b2e18cfa55c024e2b6eb6bf08165a431/api/api.go#L157-L163)
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 l is reassigned at line 159
[Click here to see the code in its original context.](https://github.com/streetbyters/forgolang_forum/blob/d6faf7a6b2e18cfa55c024e2b6eb6bf08165a431/api/api.go#L157-L163)
Click here to show the 7 line(s) of Go which triggered the analyzer.
```go
for _, l := range a.Languages {
if l.Code == code {
language = &l
exists = !exists
break
}
}
```
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: d6faf7a6b2e18cfa55c024e2b6eb6bf08165a431
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect api/api.go at lines 157-163 in commit d6faf7a6b2e18cfa55c024e2b6eb6bf08165a431, starting with the range loop and the analyzer message about l being reassigned. Determine whether taking a reference to the loop variable is a bug, mitigated, or desirable behavior, then contribute the corresponding reaction classification.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100