github-vet / github-vet/rangeloop-pointer-findings
Gruntdav/jenkins-x-local: pkg/jx/cmd/controller_role.go; 3 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Gruntdav/jenkins-x-local](https://www.github.com/Gruntdav/jenkins-x-local) at [pkg/jx/cmd/controller_role.go](https://github.com/Gruntdav/jenkins-x-local/blob/6fadcb8d6c7d60aa55d2e5d85b5b87d70cc691ab/pkg/jx/cmd/controller_role.go#L139-L141)
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.
> function call at line 140 may store a reference to role
[Click here to see the code in its original context.](https://github.com/Gruntdav/jenkins-x-local/blob/6fadcb8d6c7d60aa55d2e5d85b5b87d70cc691ab/pkg/jx/cmd/controller_role.go#L139-L141)
Click here to show the 3 line(s) of Go which triggered the analyzer.
```go
for _, role := range roles.Items {
o.UpsertRole(&role)
}
```
Click here to show extra information the analyzer produced.
```
The following graphviz dot graph describes paths through the callgraph that could lead to a function which writes a pointer argument:
digraph G {
"(UpsertRole, 1)" -> {}
}
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
```
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: 6fadcb8d6c7d60aa55d2e5d85b5b87d70cc691ab
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in pkg/jx/cmd/controller_role.go at the range loop around lines 139-141, then inspect UpsertRole to determine whether the pointer to role is retained. Confirm whether this is a real range-variable reference issue and classify the finding as Bug, Mitigated, or Desirable Behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100