github-vet / github-vet/rangeloop-pointer-findings
yepengxj/df_pkg: build/controller/factory/factory.go; 35 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [yepengxj/df_pkg](https://www.github.com/yepengxj/df_pkg) at [build/controller/factory/factory.go](https://github.com/yepengxj/df_pkg/blob/ae1f5a88b65eb8856f9461ed534dfd973f5d2496/build/controller/factory/factory.go#L551-L585)
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.
> reference to build was used in a composite literal at line 573
[Click here to see the code in its original context.](https://github.com/yepengxj/df_pkg/blob/ae1f5a88b65eb8856f9461ed534dfd973f5d2496/build/controller/factory/factory.go#L551-L585)
Click here to show the 35 line(s) of Go which triggered the analyzer.
```go
for _, build := range buildList.Items {
glog.V(5).Infof("Found build %s/%s", build.Namespace, build.Name)
if buildutil.IsBuildComplete(&build) {
glog.V(5).Infof("Ignoring build %s/%s because it is complete", build.Namespace, build.Name)
continue
}
pod, err := lw.KubeClient.Pods(build.Namespace).Get(buildutil.GetBuildPodName(&build))
if err != nil {
if !kerrors.IsNotFound(err) {
glog.V(4).Infof("Error getting pod for build %s/%s: %v", build.Namespace, build.Name, err)
return nil, err
} else {
pod = nil
}
} else {
if buildName := pod.Labels[buildapi.BuildLabel]; buildName != build.Name {
pod = nil
}
}
if pod == nil {
deletedPod := &kapi.Pod{
ObjectMeta: kapi.ObjectMeta{
Name: buildutil.GetBuildPodName(&build),
Namespace: build.Namespace,
},
}
glog.V(4).Infof("No build pod found for build %s/%s, sending delete event for build pod", build.Namespace, build.Name)
err := lw.store.Delete(deletedPod)
if err != nil {
glog.V(4).Infof("Error queuing delete event: %v", err)
}
} else {
glog.V(5).Infof("Found build pod %s/%s for build %s", pod.Namespace, pod.Name, build.Name)
}
}
```
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: ae1f5a88b65eb8856f9461ed534dfd973f5d2496
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.