diff --git a/container/client.go b/container/client.go index 44b84fe..ef36dd7 100644 --- a/container/client.go +++ b/container/client.go @@ -67,7 +67,7 @@ func (client DockerClient) ListContainers(fn ContainerFilter) ([]Container, erro c := Container{containerInfo: containerInfo, imageInfo: imageInfo} if fn(c) { - cs = append(cs, Container{containerInfo: containerInfo, imageInfo: imageInfo}) + cs = append(cs, c) } } @@ -133,12 +133,12 @@ func (client DockerClient) Start(c Container) error { log.Printf("Starting %s\n", name) } - newContainerId, err := client.api.CreateContainer(config, name) + newContainerID, err := client.api.CreateContainer(config, name) if err != nil { return err } - return client.api.StartContainer(newContainerId, hostConfig) + return client.api.StartContainer(newContainerID, hostConfig) } func (client DockerClient) Rename(c Container, newName string) error { diff --git a/container/container.go b/container/container.go index cbf59f0..423bf3b 100644 --- a/container/container.go +++ b/container/container.go @@ -26,7 +26,7 @@ func (c Container) Name() string { } func (c Container) Links() []string { - links := []string{} + var links []string if (c.containerInfo != nil) && (c.containerInfo.HostConfig != nil) { for _, link := range c.containerInfo.HostConfig.Links { @@ -81,7 +81,7 @@ func (c Container) runtimeConfig() *dockerclient.ContainerConfig { config.Volumes = structMapSubtract(config.Volumes, imageConfig.Volumes) config.ExposedPorts = structMapSubtract(config.ExposedPorts, imageConfig.ExposedPorts) - for p, _ := range c.containerInfo.HostConfig.PortBindings { + for p := range c.containerInfo.HostConfig.PortBindings { config.ExposedPorts[p] = struct{}{} } diff --git a/container/sort.go b/container/sort.go index 3465292..1e74c12 100644 --- a/container/sort.go +++ b/container/sort.go @@ -5,7 +5,8 @@ import ( "time" ) -// Sort containers by Created date +// ByCreated allows a list of Container structs to be sorted by the container's +// created date. type ByCreated []Container func (c ByCreated) Len() int { return len(c) }