github-vet / github-vet/rangeloop-pointer-findings
aceeric/nuxeo-operator: controllers/nuxeo/pvc.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [aceeric/nuxeo-operator](https://www.github.com/aceeric/nuxeo-operator) at [controllers/nuxeo/pvc.go](https://github.com/aceeric/nuxeo-operator/blob/169facb52b26858bb4b951816c23e5d6a34df57a/controllers/nuxeo/pvc.go#L103-L122)
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 109 may store a reference to expectedPvc
[Click here to see the code in its original context.](https://github.com/aceeric/nuxeo-operator/blob/169facb52b26858bb4b951816c23e5d6a34df57a/controllers/nuxeo/pvc.go#L103-L122)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, expectedPvc := range expected {
if actualPvc := getPvc(actual, expectedPvc.Name); actualPvc != nil {
if !instance.IsOwner(actualPvc.ObjectMeta) {
return fmt.Errorf("existing PVC '%v' is not owned by this Nuxeo '%v' and cannot be reconciled",
actualPvc.Name, instance.UID)
}
if !util.PvcComparer(&expectedPvc, actualPvc) {
if err := r.Delete(context.TODO(), actualPvc); err != nil {
return err
}
if err := r.Create(context.TODO(), &expectedPvc); err != nil {
return err
}
} else {
// same - nop
}
} else if err := r.Create(context.TODO(), &expectedPvc); err != nil {
return err
}
}
```
Click here to show extra information the analyzer produced.
```
The following dot graph describes paths through the callgraph that could lead to a function which writes a pointer argument:
no paths found; call may have ended in third-party code; stay tuned for diagnostics
```
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: 169facb52b26858bb4b951816c23e5d6a34df57a
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.