From eda5391d0a1d50046952acfcc370d8f639b1f0c7 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Tue, 24 Jan 2017 21:05:27 +0100 Subject: [PATCH] go fmt... --- actions/update.go | 2 +- container/client.go | 13 ++++++------- container/mockclient/mock.go | 2 +- container/util.go | 4 ---- container/util_test.go | 1 - 5 files changed, 8 insertions(+), 14 deletions(-) diff --git a/actions/update.go b/actions/update.go index 229561c..c537228 100644 --- a/actions/update.go +++ b/actions/update.go @@ -4,8 +4,8 @@ import ( "math/rand" "time" - "github.com/v2tec/watchtower/container" log "github.com/Sirupsen/logrus" + "github.com/v2tec/watchtower/container" ) var ( diff --git a/container/client.go b/container/client.go index 62dbd36..0e5b0d0 100644 --- a/container/client.go +++ b/container/client.go @@ -2,12 +2,12 @@ package container import ( "fmt" - "time" "io/ioutil" + "time" log "github.com/Sirupsen/logrus" - dockerclient "github.com/docker/docker/client" "github.com/docker/docker/api/types" + dockerclient "github.com/docker/docker/client" "golang.org/x/net/context" ) @@ -76,7 +76,7 @@ func (client dockerClient) ListContainers(fn Filter) ([]Container, error) { } c := Container{containerInfo: &containerInfo, imageInfo: &imageInfo} - if (fn(c)) { + if fn(c) { cs = append(cs, c) } } @@ -115,7 +115,7 @@ func (client dockerClient) StopContainer(c Container, timeout time.Duration) err } func (client dockerClient) StartContainer(c Container) error { - bg := context.Background(); + bg := context.Background() config := c.runtimeConfig() hostConfig := c.hostConfig() name := c.Name() @@ -144,7 +144,7 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) { if client.pullImages { log.Debugf("Pulling %s for %s", imageName, c.Name()) - + var opts types.ImagePullOptions // ImagePullOptions can take a RegistryAuth arg to authenticate against a private registry auth, err := EncodedAuth(imageName) if err != nil { @@ -163,7 +163,7 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) { return false, err } defer response.Close() - + // the pull request will be aborted prematurely unless the response is read _, err = ioutil.ReadAll(response) } @@ -179,7 +179,6 @@ func (client dockerClient) IsContainerStale(c Container) (bool, error) { } else { log.Debugf("No new images found for %s", c.Name()) } - return false, nil } diff --git a/container/mockclient/mock.go b/container/mockclient/mock.go index df2fc53..62cd321 100644 --- a/container/mockclient/mock.go +++ b/container/mockclient/mock.go @@ -3,8 +3,8 @@ package mockclient import ( "time" - "github.com/v2tec/watchtower/container" "github.com/stretchr/testify/mock" + "github.com/v2tec/watchtower/container" ) type MockClient struct { diff --git a/container/util.go b/container/util.go index 8947c82..3db01d1 100644 --- a/container/util.go +++ b/container/util.go @@ -1,8 +1,5 @@ package container -import ( -) - func sliceEqual(s1, s2 []string) bool { if len(s1) != len(s2) { return false @@ -65,4 +62,3 @@ func structMapSubtract(m1, m2 map[string]struct{}) map[string]struct{} { return m } - diff --git a/container/util_test.go b/container/util_test.go index 9ed551d..c4d5ca7 100644 --- a/container/util_test.go +++ b/container/util_test.go @@ -63,4 +63,3 @@ func TestStructMapSubtract(t *testing.T) { assert.Equal(t, map[string]struct{}{"a": x, "b": x, "c": x}, m1) assert.Equal(t, map[string]struct{}{"a": x, "c": x}, m2) } -