mirror of
https://github.com/containers/podman.git
synced 2025-06-26 04:46:57 +08:00
Fix gofmt & golint
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #412 Approved by: baude
This commit is contained in:
@ -252,7 +252,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
|
|||||||
// This really ought to be a do-while, but Go doesn't have those...
|
// This really ought to be a do-while, but Go doesn't have those...
|
||||||
for found {
|
for found {
|
||||||
found = false
|
found = false
|
||||||
for id, _ := range c.state.ExecSessions {
|
for id := range c.state.ExecSessions {
|
||||||
if id == sessionID {
|
if id == sessionID {
|
||||||
found = true
|
found = true
|
||||||
break
|
break
|
||||||
@ -277,7 +277,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
|
|||||||
|
|
||||||
// Wait until runc makes the pidfile
|
// Wait until runc makes the pidfile
|
||||||
// TODO: If runc errors before the PID file is created, we have to wait for timeout here
|
// TODO: If runc errors before the PID file is created, we have to wait for timeout here
|
||||||
if err := WaitForFile(pidFile, pidWaitTimeout * time.Millisecond); err != nil {
|
if err := WaitForFile(pidFile, pidWaitTimeout*time.Millisecond); err != nil {
|
||||||
logrus.Debugf("Timed out waiting for pidfile from runc for container %s exec", c.ID())
|
logrus.Debugf("Timed out waiting for pidfile from runc for container %s exec", c.ID())
|
||||||
|
|
||||||
// Check if an error occurred in the process before we made a pidfile
|
// Check if an error occurred in the process before we made a pidfile
|
||||||
@ -600,9 +600,8 @@ func (c *Container) Wait() (int32, error) {
|
|||||||
}
|
}
|
||||||
if !stopped {
|
if !stopped {
|
||||||
return false, nil
|
return false, nil
|
||||||
} else { // nolint
|
}
|
||||||
return true, nil // nolint
|
return true, nil
|
||||||
} // nolint
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -21,7 +21,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
execIDs := []string{}
|
execIDs := []string{}
|
||||||
for id, _ := range c.state.ExecSessions {
|
for id := range c.state.ExecSessions {
|
||||||
execIDs = append(execIDs, id)
|
execIDs = append(execIDs, id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ func (c *Container) attachSocketPath() string {
|
|||||||
|
|
||||||
// Get PID file path for a container's exec session
|
// Get PID file path for a container's exec session
|
||||||
func (c *Container) execPidPath(sessionID string) string {
|
func (c *Container) execPidPath(sessionID string) string {
|
||||||
return filepath.Join(c.state.RunDir, "exec_pid_" + sessionID)
|
return filepath.Join(c.state.RunDir, "exec_pid_"+sessionID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sync this container with on-disk state and runc status
|
// Sync this container with on-disk state and runc status
|
||||||
|
@ -313,7 +313,7 @@ func (s *SQLState) UpdateContainer(ctr *Container) error {
|
|||||||
&netNSPath,
|
&netNSPath,
|
||||||
&ipAddress,
|
&ipAddress,
|
||||||
&subnetMask,
|
&subnetMask,
|
||||||
&execSessions)
|
&execSessions)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// The container may not exist in the database
|
// The container may not exist in the database
|
||||||
if err == sql.ErrNoRows {
|
if err == sql.ErrNoRows {
|
||||||
|
@ -49,12 +49,12 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
state: &containerState{
|
state: &containerState{
|
||||||
State: ContainerStateRunning,
|
State: ContainerStateRunning,
|
||||||
ConfigPath: "/does/not/exist/specs/" + id,
|
ConfigPath: "/does/not/exist/specs/" + id,
|
||||||
RunDir: "/does/not/exist/tmp/",
|
RunDir: "/does/not/exist/tmp/",
|
||||||
Mounted: true,
|
Mounted: true,
|
||||||
Mountpoint: "/does/not/exist/tmp/" + id,
|
Mountpoint: "/does/not/exist/tmp/" + id,
|
||||||
PID: 1234,
|
PID: 1234,
|
||||||
ExecSessions: map[string]int{"abcd": 101, "ef01": 202},
|
ExecSessions: map[string]int{"abcd": 101, "ef01": 202},
|
||||||
},
|
},
|
||||||
valid: true,
|
valid: true,
|
||||||
|
Reference in New Issue
Block a user