github-vet / github-vet/rangeloop-pointer-findings
litmuschaos/chaos-exporter: controller/scrape.go; 16 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [litmuschaos/chaos-exporter](https://www.github.com/litmuschaos/chaos-exporter) at [controller/scrape.go](https://github.com/litmuschaos/chaos-exporter/blob/bb8404698f8176b34dc445e612f16d09efcc6a59/controller/scrape.go#L55-L70)
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 chaosEngine at line 68 may start a goroutine
[Click here to see the code in its original context.](https://github.com/litmuschaos/chaos-exporter/blob/bb8404698f8176b34dc445e612f16d09efcc6a59/controller/scrape.go#L55-L70)
Click here to show the 16 line(s) of Go which triggered the analyzer.
```go
for _, chaosEngine := range filteredChaosEngineList.Items {
totalEngine, passedEngine, failedEngine, awaitedEngine := getExperimentMetricsFromEngine(&chaosEngine)
klog.V(0).Infof("ChaosEngineMetrics: EngineName: %v, EngineNamespace: %v, TotalExp: %v, PassedExp: %v, FailedExp: %v, TotalRunningExp: %v", chaosEngine.Name, chaosEngine.Namespace, totalEngine, passedEngine, failedEngine, len(experimentStatusMap))
var engineDetails ChaosEngineDetail
engineDetails.Name = chaosEngine.Name
engineDetails.Namespace = chaosEngine.Namespace
engineDetails.TotalExp = totalEngine
engineDetails.PassedExp = passedEngine
engineDetails.FailedExp = failedEngine
engineDetails.AwaitedExp = awaitedEngine
total += totalEngine
pass += passedEngine
fail += failedEngine
setEngineChaosMetrics(engineDetails, &chaosEngine)
setAwsEngineChaosMetrics(engineDetails, &chaosEngine)
}
```
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 {
"(addConnIfNeeded, 3)" -> {}
"(setEngineChaosMetrics, 2)" -> {"(Set, 1)";}
"(Set, 1)" -> {"(New, 1)";}
"(New, 1)" -> {"(get, 1)";}
"(get, 1)" -> {"(SetTransportDefaults, 1)";}
"(SetTransportDefaults, 1)" -> {"(ConfigureTransport, 1)";}
"(ConfigureTransport, 1)" -> {"(configureTransport, 1)";}
"(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: bb8404698f8176b34dc445e612f16d09efcc6a59
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.