mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-02 09:24:35 +00:00
Merge pull request #2290 from tedyu/get-container
vc: Use map built-in accessor to find container in Sandbox#GetContainer
This commit is contained in:
@@ -279,11 +279,9 @@ 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 {
|
||||
if c, ok := s.containers[containerID]; ok {
|
||||
return c
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user