containerd/supervisor/get_containers.go
Kenfe-Mickaël Laventure 5624732128 Add golint to test (#255)
* Add a new lint rule to the Makefile

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Fix linter errors

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>

* Allow replacing the default apt mirror

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
2016-06-03 15:00:49 -07:00

30 lines
579 B
Go

package supervisor
import "github.com/docker/containerd/runtime"
// GetContainersTask holds needed parameters to retrieve a list of
// containers
type GetContainersTask struct {
baseTask
ID string
Containers []runtime.Container
}
func (s *Supervisor) getContainers(t *GetContainersTask) error {
if t.ID != "" {
ci, ok := s.containers[t.ID]
if !ok {
return ErrContainerNotFound
}
t.Containers = append(t.Containers, ci.container)
return nil
}
for _, ci := range s.containers {
t.Containers = append(t.Containers, ci.container)
}
return nil
}