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:
Peng Tao
2019-12-02 10:29:44 +08:00
committed by GitHub

View File

@@ -279,11 +279,9 @@ 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
} }