mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-17 00:43:36 +00:00
vc: Use map built-in accessor to find container in Sandbox#GetContainer
Fixes #2289 Signed-off-by: Ted Yu <yuzhihong@gmail.com>
This commit is contained in:
parent
d054556f60
commit
38224e8b7b
@ -279,10 +279,8 @@ func (s *Sandbox) GetAllContainers() []VCContainer {
|
|||||||
|
|
||||||
// GetContainer returns the container named by the containerID.
|
// GetContainer returns the container named by the containerID.
|
||||||
func (s *Sandbox) GetContainer(containerID string) VCContainer {
|
func (s *Sandbox) GetContainer(containerID string) VCContainer {
|
||||||
for id, c := range s.containers {
|
if c, ok := s.containers[containerID]; ok {
|
||||||
if id == containerID {
|
return c
|
||||||
return c
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user