Go-lint clean-up

pull/1/head
Brian DeHamer 9 years ago
parent 4ba21639a0
commit cc1efc20e2

@ -67,7 +67,7 @@ func (client DockerClient) ListContainers(fn ContainerFilter) ([]Container, erro
c := Container{containerInfo: containerInfo, imageInfo: imageInfo} c := Container{containerInfo: containerInfo, imageInfo: imageInfo}
if fn(c) { 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) log.Printf("Starting %s\n", name)
} }
newContainerId, err := client.api.CreateContainer(config, name) newContainerID, err := client.api.CreateContainer(config, name)
if err != nil { if err != nil {
return err return err
} }
return client.api.StartContainer(newContainerId, hostConfig) return client.api.StartContainer(newContainerID, hostConfig)
} }
func (client DockerClient) Rename(c Container, newName string) error { func (client DockerClient) Rename(c Container, newName string) error {

@ -26,7 +26,7 @@ func (c Container) Name() string {
} }
func (c Container) Links() []string { func (c Container) Links() []string {
links := []string{} var links []string
if (c.containerInfo != nil) && (c.containerInfo.HostConfig != nil) { if (c.containerInfo != nil) && (c.containerInfo.HostConfig != nil) {
for _, link := range c.containerInfo.HostConfig.Links { 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.Volumes = structMapSubtract(config.Volumes, imageConfig.Volumes)
config.ExposedPorts = structMapSubtract(config.ExposedPorts, imageConfig.ExposedPorts) 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{}{} config.ExposedPorts[p] = struct{}{}
} }

@ -5,7 +5,8 @@ import (
"time" "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 type ByCreated []Container
func (c ByCreated) Len() int { return len(c) } func (c ByCreated) Len() int { return len(c) }

Loading…
Cancel
Save