github-vet / github-vet/rangeloop-pointer-findings
write2madhu/oshift1: Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go; 27 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [write2madhu/oshift1](https://www.github.com/write2madhu/oshift1) at [Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go](https://github.com/write2madhu/oshift1/blob/43d4d9b6591bba12d001f13334c5417af61a9eef/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go#L3485-L3511)
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 which takes a reference to container at line 3487 may start a goroutine
[Click here to see the code in its original context.](https://github.com/write2madhu/oshift1/blob/43d4d9b6591bba12d001f13334c5417af61a9eef/Godeps/_workspace/src/k8s.io/kubernetes/pkg/kubelet/kubelet.go#L3485-L3511)
Click here to show the 27 line(s) of Go which triggered the analyzer.
```go
for _, container := range pod.Spec.Containers {
// If a container should be restarted in next syncpod, it is *Waiting*.
if !kubecontainer.ShouldContainerBeRestarted(&container, pod, podStatus) {
continue
}
status := statuses[container.Name]
reason, message, ok := kl.reasonCache.Get(uid, container.Name)
if !ok {
// In fact, we could also apply Waiting state here, but it is less informative,
// and the container will be restarted soon, so we prefer the original state here.
// Note that with the current implementation of ShouldContainerBeRestarted the original state here
// could be:
// * Waiting: There is no associated historical container and start failure reason record.
// * Terminated: The container is terminated.
continue
}
if status.State.Terminated != nil {
status.LastTerminationState = status.State
}
status.State = api.ContainerState{
Waiting: &api.ContainerStateWaiting{
Reason: reason.Error(),
Message: message,
},
}
statuses[container.Name] = status
}
```
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: 43d4d9b6591bba12d001f13334c5417af61a9eef
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.