github-vet / github-vet/rangeloop-pointer-findings
rancher/rio: cli/pkg/clicontext/types.go; 6 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [rancher/rio](https://www.github.com/rancher/rio) at [cli/pkg/clicontext/types.go](https://github.com/rancher/rio/blob/e9d490246e7252a04eb872a99f542c5da2f135cf/cli/pkg/clicontext/types.go#L73-L78)
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 which takes a reference to svc at line 76 may start a goroutine
[Click here to see the code in its original context.](https://github.com/rancher/rio/blob/e9d490246e7252a04eb872a99f542c5da2f135cf/cli/pkg/clicontext/types.go#L73-L78)
Click here to show the 6 line(s) of Go which triggered the analyzer.
```go
for _, svc := range svcs.Items {
app, version := services.AppAndVersion(&svc)
if app == res.App && version == res.Version {
return &svc, gvk.Set(&svc)
}
}
```
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 calling a goroutine:
digraph G {
"(Set, 1)" -> {"(New, 1)";}
"(Store, 2)" -> {"(Write, 1)";"(Encode, 1)";}
"(AddTraceEvent, 3)" -> {"(traceEvent, 2)";}
"(append, 1)" -> {}
"(Encode, 1)" -> {"(Write, 1)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(Write, 1)" -> {"(Info, 2)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(addConnIfNeeded, 3)" -> {}
"(Info, 2)" -> {"(AddTraceEvent, 3)";}
"(traceEvent, 2)" -> {"(append, 1)";}
"(New, 1)" -> {"(get, 1)";"(Store, 2)";}
"(configureTransport, 1)" -> {"(addConnIfNeeded, 3)";}
}
```
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: e9d490246e7252a04eb872a99f542c5da2f135cf
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.