github-vet / github-vet/rangeloop-pointer-findings
yashbhutwala/kb-tutorial-cronjob-controller: controllers/cronjob_controller.go; 26 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yashbhutwala/kb-tutorial-cronjob-controller](https://www.github.com/yashbhutwala/kb-tutorial-cronjob-controller) at [controllers/cronjob_controller.go](https://github.com/yashbhutwala/kb-tutorial-cronjob-controller/blob/b38315f0f0ef39063df6cf5f62c55ce41cc3b040/controllers/cronjob_controller.go#L132-L157)
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/yashbhutwala/kb-tutorial-cronjob-controller/blob/b38315f0f0ef39063df6cf5f62c55ce41cc3b040/controllers/cronjob_controller.go#L132-L157)
Click here to show the 26 line(s) of Go which triggered the analyzer.
```go
for i, job := range childJobs.Items {
_, finishedType := isJobFinished(&job)
switch finishedType {
case "": // ongoing
activeJobs = append(activeJobs, &childJobs.Items[i])
case kbatch.JobFailed:
failedJobs = append(failedJobs, &childJobs.Items[i])
case kbatch.JobComplete:
successfulJobs = append(successfulJobs, &childJobs.Items[i])
}
// We'll store the launch time in an annotation, so we'll reconsitute that from
// the active jobs themselves.
scheduledTimeForJob, err := getScheduledTimeForJob(&job)
if err != nil {
log.Error(err, "unable to parse schedule time for child job", "job", &job)
continue
}
if scheduledTimeForJob != nil {
if mostRecentTime == nil {
mostRecentTime = scheduledTimeForJob
} else if mostRecentTime.Before(*scheduledTimeForJob) {
mostRecentTime = scheduledTimeForJob
}
}
}
```
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 {Error 4} 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: b38315f0f0ef39063df6cf5f62c55ce41cc3b040
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.