github-vet / github-vet/rangeloop-pointer-findings
bythepowerof/kmake-controller: controllers/kmakenowscheduler_controller.go; 54 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [bythepowerof/kmake-controller](https://www.github.com/bythepowerof/kmake-controller) at [controllers/kmakenowscheduler_controller.go](https://github.com/bythepowerof/kmake-controller/blob/ceb6190632b501bc28c9dea09454dca8fb13ba30/controllers/kmakenowscheduler_controller.go#L203-L256)
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/bythepowerof/kmake-controller/blob/ceb6190632b501bc28c9dea09454dca8fb13ba30/controllers/kmakenowscheduler_controller.go#L203-L256)
Click here to show the 54 line(s) of Go which triggered the analyzer.
```go
for _, run := range runs.Items {
kmakeName := bythepowerofv1.GetDomainLabel(run.Labels, bythepowerofv1.KmakeLabel)
if kmakeName != "" {
found := false
for _, i := range allRuns {
if i == run.GetName() {
found = true
break
}
}
if !found {
kmsr := &bythepowerofv1.KmakeScheduleRun{
ObjectMeta: ObjectMetaConcat(instance, req.NamespacedName, bythepowerofv1.ScheduleRun),
Spec: bythepowerofv1.KmakeScheduleRunSpec{
KmakeScheduleRunOperation: bythepowerofv1.KmakeScheduleRunOperation{
Start: &bythepowerofv1.KmakeScheduleRunStart{},
},
},
}
ctrl.SetControllerReference(instance, kmsr, r.Scheme)
SetOwnerReference(&run, kmsr, r.Scheme)
kmsr.SetLabels(map[string]string{
bythepowerofv1.MakeDomainString(bythepowerofv1.KmakeLabel): kmakeName,
bythepowerofv1.MakeDomainString(bythepowerofv1.ScheduleInstLabel): instance.Name,
bythepowerofv1.MakeDomainString(bythepowerofv1.ScheduleEnvLabel): currentenvmap.GetName(),
bythepowerofv1.MakeDomainString(bythepowerofv1.RunLabel): run.GetName(),
bythepowerofv1.MakeDomainString(bythepowerofv1.WorkloadLabel): "yes",
bythepowerofv1.MakeDomainString(bythepowerofv1.StatusLabel): "Provision",
})
err = r.Create(ctx, kmsr)
if err != nil {
return reconcile.Result{}, err
}
// seems we need to refetch the instance here
instance = &bythepowerofv1.KmakeNowScheduler{}
err = r.Get(ctx, req.NamespacedName, instance)
if err != nil {
return reconcile.Result{}, err
}
err = r.Event(instance, bythepowerofv1.Provision, bythepowerofv1.Runs, kmsr.GetName())
if err != nil {
return reconcile.Result{}, err
}
// return requeue, nil
allRuns = append(allRuns, run.GetName())
}
} else {
log.Info(fmt.Sprintf("run %v not connected to kmake", instance.GetName()))
}
}
```
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 {SetOwnerReference 3} 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: ceb6190632b501bc28c9dea09454dca8fb13ba30
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.