From cc1efc20e2ec5764efed5845a17a142e83fdbcbd Mon Sep 17 00:00:00 2001 From: Brian DeHamer Date: Tue, 21 Jul 2015 21:40:22 +0000 Subject: [PATCH] Go-lint clean-up --- container/client.go | 6 +++--- container/container.go | 4 ++-- container/sort.go | 3 ++- 3 files changed, 7 insertions(+), 6 deletions(-) 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) }