mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-13 23:24:14 +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.
|
||||
func (s *Sandbox) GetContainer(containerID string) VCContainer {
|
||||
for id, c := range s.containers {
|
||||
if id == containerID {
|
||||
return c
|
||||
}
|
||||
if c, ok := s.containers[containerID]; ok {
|
||||
return c
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user