From e7d086c2be41dfedfa5f2fb0c437eb5bbf6f2f5d Mon Sep 17 00:00:00 2001 From: Alexander Morozov Date: Fri, 12 Dec 2014 10:38:48 -0800 Subject: [PATCH] Fix vet errors about unkeyed fields Signed-off-by: Alexander Morozov --- daemon/daemon.go | 4 ++-- daemon/execdriver/lxc/driver.go | 12 ++++++------ daemon/execdriver/native/driver.go | 12 ++++++------ daemon/state_test.go | 2 +- integration/runtime_test.go | 2 +- pkg/chrootarchive/archive.go | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/daemon/daemon.go b/daemon/daemon.go index a2e6a79bd6..2dcd3c3124 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -234,7 +234,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err log.Debugf("killing old running container %s", container.ID) existingPid := container.Pid - container.SetStopped(&execdriver.ExitStatus{0, false}) + container.SetStopped(&execdriver.ExitStatus{ExitCode: 0}) // We only have to handle this for lxc because the other drivers will ensure that // no processes are left when docker dies @@ -266,7 +266,7 @@ func (daemon *Daemon) register(container *Container, updateSuffixarray bool) err log.Debugf("Marking as stopped") - container.SetStopped(&execdriver.ExitStatus{-127, false}) + container.SetStopped(&execdriver.ExitStatus{ExitCode: -127}) if err := container.ToDisk(); err != nil { return err } diff --git a/daemon/execdriver/lxc/driver.go b/daemon/execdriver/lxc/driver.go index 642247c851..c02ceae97a 100644 --- a/daemon/execdriver/lxc/driver.go +++ b/daemon/execdriver/lxc/driver.go @@ -76,11 +76,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba }) if err := d.generateEnvConfig(c); err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } configPath, err := d.generateLXCConfig(c) if err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } params := []string{ "lxc-start", @@ -154,11 +154,11 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba c.ProcessConfig.Args = append([]string{name}, arg...) if err := nodes.CreateDeviceNodes(c.Rootfs, c.AutoCreatedDevices); err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } if err := c.ProcessConfig.Start(); err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } var ( @@ -182,7 +182,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba c.ProcessConfig.Process.Kill() c.ProcessConfig.Wait() } - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } c.ContainerPid = pid @@ -193,7 +193,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba <-waitLock - return execdriver.ExitStatus{getExitCode(c), false}, waitErr + return execdriver.ExitStatus{ExitCode: getExitCode(c)}, waitErr } /// Return the exit code of the process diff --git a/daemon/execdriver/native/driver.go b/daemon/execdriver/native/driver.go index 01455a8101..a036abc212 100644 --- a/daemon/execdriver/native/driver.go +++ b/daemon/execdriver/native/driver.go @@ -74,7 +74,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba // take the Command and populate the libcontainer.Config from it container, err := d.createContainer(c) if err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } var term execdriver.Terminal @@ -85,7 +85,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba term, err = execdriver.NewStdConsole(&c.ProcessConfig, pipes) } if err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } c.ProcessConfig.Terminal = term @@ -102,12 +102,12 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba ) if err := d.createContainerRoot(c.ID); err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } defer d.cleanContainer(c.ID) if err := d.writeContainerFile(container, c.ID); err != nil { - return execdriver.ExitStatus{-1, false}, err + return execdriver.ExitStatus{ExitCode: -1}, err } execOutputChan := make(chan execOutput, 1) @@ -146,7 +146,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba select { case execOutput := <-execOutputChan: - return execdriver.ExitStatus{execOutput.exitCode, false}, execOutput.err + return execdriver.ExitStatus{ExitCode: execOutput.exitCode}, execOutput.err case <-waitForStart: break } @@ -161,7 +161,7 @@ func (d *driver) Run(c *execdriver.Command, pipes *execdriver.Pipes, startCallba // wait for the container to exit. execOutput := <-execOutputChan - return execdriver.ExitStatus{execOutput.exitCode, oomKill}, execOutput.err + return execdriver.ExitStatus{ExitCode: execOutput.exitCode, OOMKilled: oomKill}, execOutput.err } func (d *driver) Kill(p *execdriver.Command, sig int) error { diff --git a/daemon/state_test.go b/daemon/state_test.go index 32c005cf2e..861076aeb2 100644 --- a/daemon/state_test.go +++ b/daemon/state_test.go @@ -49,7 +49,7 @@ func TestStateRunStop(t *testing.T) { atomic.StoreInt64(&exit, int64(exitCode)) close(stopped) }() - s.SetStopped(&execdriver.ExitStatus{i, false}) + s.SetStopped(&execdriver.ExitStatus{ExitCode: i}) if s.IsRunning() { t.Fatal("State is running") } diff --git a/integration/runtime_test.go b/integration/runtime_test.go index d173af1f7f..93a32e9f70 100644 --- a/integration/runtime_test.go +++ b/integration/runtime_test.go @@ -653,7 +653,7 @@ func TestRestore(t *testing.T) { if err := container3.Run(); err != nil { t.Fatal(err) } - container2.SetStopped(&execdriver.ExitStatus{0, false}) + container2.SetStopped(&execdriver.ExitStatus{ExitCode: 0}) } func TestDefaultContainerName(t *testing.T) { diff --git a/pkg/chrootarchive/archive.go b/pkg/chrootarchive/archive.go index 0077f930d6..66f837314a 100644 --- a/pkg/chrootarchive/archive.go +++ b/pkg/chrootarchive/archive.go @@ -16,7 +16,7 @@ import ( "github.com/docker/docker/pkg/reexec" ) -var chrootArchiver = &archive.Archiver{Untar} +var chrootArchiver = &archive.Archiver{Untar: Untar} func chroot(path string) error { if err := syscall.Chroot(path); err != nil {