github-vet / github-vet/rangeloop-pointer-findings

litmuschaos/litmus-go: pkg/result/chaosresult.go; 12 LoC

Open
#13,063 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [litmuschaos/litmus-go](https://www.github.com/litmuschaos/litmus-go) at [pkg/result/chaosresult.go](https://github.com/litmuschaos/litmus-go/blob/bcdcf88315cd76c0b366fd4dc902db36f1ac7a91/pkg/result/chaosresult.go#L59-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 at line 64 passes reference to result to third-party code

[Click here to see the code in its original context.](https://github.com/litmuschaos/litmus-go/blob/bcdcf88315cd76c0b366fd4dc902db36f1ac7a91/pkg/result/chaosresult.go#L59-L70)

Click here to show the 12 line(s) of Go which triggered the analyzer.

```go
for _, result := range resultList.Items {

// the chaos-result is already present with matching labels
// it will patch the new parameters in the same chaos-result
if state == "SOT" {
return PatchChaosResult(&result, clients, chaosDetails, resultDetails, experimentLabel)
}

// it will patch the chaos-result in the end of experiment
resultDetails.Phase = "Completed"
return PatchChaosResult(&result, clients, chaosDetails, resultDetails, experimentLabel)
}

```

Click here to show extra information the analyzer produced.

```
No path was found through the callgraph that could lead to a function which writes a pointer argument.

The following graphviz dot graph describes paths through the callgraph that could lead to a function which passes a pointer to third-party code:
digraph G {
"(PatchChaosResult, 5)" -> {"(Update, 1)";}
"(Update, 1)" -> {"(UpdateWithEventNamespace, 1)";}
"(UpdateWithEventNamespace, 1)" -> {}
}

```

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: bcdcf88315cd76c0b366fd4dc902db36f1ac7a91

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.