github-vet / github-vet/rangeloop-pointer-findings
gomberg5264/flynn2: host/cli/cli-add-command.go; 6 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [gomberg5264/flynn2](https://www.github.com/gomberg5264/flynn2) at [host/cli/cli-add-command.go](https://github.com/gomberg5264/flynn2/blob/a5c70b2ae84be8ce9a3b54d68903c2b67051d01d/host/cli/cli-add-command.go#L79-L84)
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 job is reassigned at line 80
[Click here to see the code in its original context.](https://github.com/gomberg5264/flynn2/blob/a5c70b2ae84be8ce9a3b54d68903c2b67051d01d/host/cli/cli-add-command.go#L79-L84)
Click here to show the 6 line(s) of Go which triggered the analyzer.
```go
for _, job := range hostJobs {
p := &job
controller.offer(p)
router.offer(p)
dashboard.offer(p)
}
```
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: a5c70b2ae84be8ce9a3b54d68903c2b67051d01d
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with host/cli/cli-add-command.go lines 79-84 and inspect how the pointers passed to controller.offer, router.offer, and dashboard.offer are used. Confirm whether the reported reassignment of the range-loop variable can affect later behavior, then verify the finding against the surrounding CLI code. Done means the behavior is confirmed and the issue is classified as a bug or mitigated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100