github-vet / github-vet/rangeloop-pointer-findings
kabanero-io/kabanero-operator: pkg/controller/kabaneroplatform/featured_stacks.go; 37 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [kabanero-io/kabanero-operator](https://www.github.com/kabanero-io/kabanero-operator) at [pkg/controller/kabaneroplatform/featured_stacks.go](https://github.com/kabanero-io/kabanero-operator/blob/cc682f151a73cf349a911d2f7862838088cc9f61/pkg/controller/kabaneroplatform/featured_stacks.go#L172-L208)
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.
>
[Click here to see the code in its original context.](https://github.com/kabanero-io/kabanero-operator/blob/cc682f151a73cf349a911d2f7862838088cc9f61/pkg/controller/kabaneroplatform/featured_stacks.go#L172-L208)
Click here to show the 37 line(s) of Go which triggered the analyzer.
```go
for _, deployedStack := range deployedStacks.Items {
iStackList, _ := indexStackMap[deployedStack.GetName()]
newStackVersions := []kabanerov1alpha2.StackVersion{}
for _, dStackVersion := range deployedStack.Spec.Versions {
deployedStackVersionMatchIndex := false
// Keep the stacks with matching versions. The caller will do the updates if necessary.
for _, iStack := range iStackList {
if dStackVersion.Version == iStack.Version {
deployedStackVersionMatchIndex = true
newStackVersions = append(newStackVersions, dStackVersion)
break
}
}
// Keep any stack versions that have a desired state that is not empty.
if !deployedStackVersionMatchIndex && len(dStackVersion.DesiredState) > 0 {
newStackVersions = append(newStackVersions, dStackVersion)
continue
}
}
// If there were no indications that the stack should be kept around, delete it.
if len(newStackVersions) == 0 {
err := cl.Delete(ctx, &deployedStack)
if err != nil {
return err
}
break
}
// If there were differences between the deployed list of versions and the list of deployed versions that need to be kept,
// update the current stack.
if len(deployedStack.Spec.Versions) != len(newStackVersions) {
deployedStack.Spec.Versions = newStackVersions
cl.Update(ctx, &deployedStack)
}
}
```
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.
No path was found through the callgraph that could lead to a function which passes a pointer to third-party code.
root signature {Update 2} was not found in the callgraph; reference was passed directly 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: cc682f151a73cf349a911d2f7862838088cc9f61
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.