Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #2290 from tedyu/get-container
Browse files Browse the repository at this point in the history
vc: Use map built-in accessor to find container in Sandbox#GetContainer
  • Loading branch information
bergwolf authored Dec 2, 2019
2 parents e49569a + 38224e8 commit 450a646
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 450a646

Please sign in to comment.