fix captured loop variable

This commit is contained in:
Daniel Smith 2014-10-07 13:57:30 -07:00
parent 7ffe791486
commit 2d048bc0f2

View File

@ -59,7 +59,8 @@ func (kl *Kubelet) runOnce(pods []Pod) (results []RunPodResult, err error) {
pods = filterHostPortConflicts(pods) pods = filterHostPortConflicts(pods)
ch := make(chan RunPodResult) ch := make(chan RunPodResult)
for _, pod := range pods { for i := range pods {
pod := pods[i] // Make a copy
go func() { go func() {
info, err := kl.runPod(pod) info, err := kl.runPod(pod)
ch <- RunPodResult{&pod, info, err} ch <- RunPodResult{&pod, info, err}