Fix gofmt & golint

Signed-off-by: Matthew Heon <matthew.heon@gmail.com>

Closes: #412
Approved by: baude
This commit is contained in:
Matthew Heon
2018-02-27 15:36:36 -05:00
committed by Atomic Bot
parent 780baec1d9
commit 83d7ae6506
5 changed files with 13 additions and 14 deletions

View File

@ -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...
for found {
found = false
for id, _ := range c.state.ExecSessions {
for id := range c.state.ExecSessions {
if id == sessionID {
found = true
break
@ -277,7 +277,7 @@ func (c *Container) Exec(tty, privileged bool, env, cmd []string, user string) e
// Wait until runc makes the pidfile
// 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())
// 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 {
return false, nil
} else { // nolint
return true, nil // nolint
} // nolint
}
return true, nil
},
)
if err != nil {

View File

@ -21,7 +21,7 @@ func (c *Container) getContainerInspectData(size bool, driverData *inspect.Data)
}
execIDs := []string{}
for id, _ := range c.state.ExecSessions {
for id := range c.state.ExecSessions {
execIDs = append(execIDs, id)
}

View File

@ -102,7 +102,7 @@ func (c *Container) attachSocketPath() string {
// Get PID file path for a container's exec session
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

View File

@ -313,7 +313,7 @@ func (s *SQLState) UpdateContainer(ctr *Container) error {
&netNSPath,
&ipAddress,
&subnetMask,
&execSessions)
&execSessions)
if err != nil {
// The container may not exist in the database
if err == sql.ErrNoRows {

View File

@ -49,12 +49,12 @@ func getTestContainer(id, name, locksDir string) (*Container, error) {
},
},
state: &containerState{
State: ContainerStateRunning,
ConfigPath: "/does/not/exist/specs/" + id,
RunDir: "/does/not/exist/tmp/",
Mounted: true,
Mountpoint: "/does/not/exist/tmp/" + id,
PID: 1234,
State: ContainerStateRunning,
ConfigPath: "/does/not/exist/specs/" + id,
RunDir: "/does/not/exist/tmp/",
Mounted: true,
Mountpoint: "/does/not/exist/tmp/" + id,
PID: 1234,
ExecSessions: map[string]int{"abcd": 101, "ef01": 202},
},
valid: true,