github-vet / github-vet/rangeloop-pointer-findings
project-flogo/grpc: proto/grpc2grpc/harness.go; 5 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [project-flogo/grpc](https://www.github.com/project-flogo/grpc) at [proto/grpc2grpc/harness.go](https://github.com/project-flogo/grpc/blob/29e1aee3fb4974464361a243d2f2dabdf5d1b8a9/proto/grpc2grpc/harness.go#L331-L335)
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 user was used in a composite literal at line 333
[Click here to see the code in its original context.](https://github.com/project-flogo/grpc/blob/29e1aee3fb4974464361a243d2f2dabdf5d1b8a9/proto/grpc2grpc/harness.go#L331-L335)
Click here to show the 5 line(s) of Go which triggered the analyzer.
```go
for _, user := range t.userMapArr {
if req.Username == user.Username {
return &UserResponse{User: &user}, nil
}
}
```
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: 29e1aee3fb4974464361a243d2f2dabdf5d1b8a9
Contributor guide
No contributing guide indexed for this repository
Research direction
Review proto/grpc2grpc/harness.go at lines 331-335 and the range-loop pointer finding described in the issue. Confirm whether the returned UserResponse safely refers to the matched user, then update the code if the analyzer finding is a bug and verify the grpc2grpc package behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100