github-vet / github-vet/rangeloop-pointer-findings
weliang1/upstream: 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 [weliang1/upstream](https://www.github.com/weliang1/upstream) at [pkg/build/controller/factory/factory.go](https://github.com/weliang1/upstream/blob/1532bfcc115ccbd74a084568bbc55d131f6e9bf2/pkg/build/controller/factory/factory.go#L575-L609)
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 597
[Click here to see the code in its original context.](https://github.com/weliang1/upstream/blob/1532bfcc115ccbd74a084568bbc55d131f6e9bf2/pkg/build/controller/factory/factory.go#L575-L609)
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(buildapi.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 := buildapi.GetBuildName(pod); buildName != build.Name {
pod = nil
}
}
if pod == nil {
deletedPod := &kapi.Pod{
ObjectMeta: kapi.ObjectMeta{
Name: buildapi.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: 1532bfcc115ccbd74a084568bbc55d131f6e9bf2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.