From 7e9ea5342a96b455a5a0353a7addb261ef3b3d76 Mon Sep 17 00:00:00 2001 From: Yong Tang Date: Wed, 16 Nov 2016 22:17:40 -0800 Subject: [PATCH] Fix several issues with `go vet` and `go fmt` For some reason, `go vet` and `go fmt` validate does not capture several issues. The following was the output of `go vet`: ``` ubuntu@ubuntu:~/docker$ go vet ./... 2>&1 | grep -v ^vendor | grep -v '^exit status 1$' cli/command/formatter/container_test.go:393: possible formatting directive in Log call volume/volume_test.go:257: arg mp.RW for printf verb %s of wrong type: bool ``` The following was the output of `go fmt -s`: ``` ubuntu@ubuntu:~/docker$ gofmt -s -l . | grep -v ^vendor cli/command/stack/list.go daemon/commit.go ``` Fixed above issues with `go vet` and `go fmt -s` Signed-off-by: Yong Tang Upstream-commit: d691bce8c9c849aeb52521c0c174d8aa3707dbaa Component: cli --- components/cli/command/formatter/container_test.go | 4 ++-- components/cli/command/stack/list.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/cli/command/formatter/container_test.go b/components/cli/command/formatter/container_test.go index cdfc911a94..16137897b9 100644 --- a/components/cli/command/formatter/container_test.go +++ b/components/cli/command/formatter/container_test.go @@ -372,7 +372,7 @@ func TestContainerContextWriteJSONField(t *testing.T) { } func TestContainerBackCompat(t *testing.T) { - containers := []types.Container{types.Container{ID: "brewhaha"}} + containers := []types.Container{{ID: "brewhaha"}} cases := []string{ "ID", "Names", @@ -390,7 +390,7 @@ func TestContainerBackCompat(t *testing.T) { for _, c := range cases { ctx := Context{Format: Format(fmt.Sprintf("{{ .%s }}", c)), Output: buf} if err := ContainerWrite(ctx, containers); err != nil { - t.Log("could not render template for field '%s': %v", c, err) + t.Logf("could not render template for field '%s': %v", c, err) t.Fail() } buf.Reset() diff --git a/components/cli/command/stack/list.go b/components/cli/command/stack/list.go index 7be42525dd..f655b929ad 100644 --- a/components/cli/command/stack/list.go +++ b/components/cli/command/stack/list.go @@ -72,7 +72,7 @@ func printTable(out io.Writer, stacks []*stack) { type stack struct { // Name is the name of the stack - Name string + Name string // Services is the number of the services Services int }