diff --git a/cli/command/formatter/history.go b/cli/command/formatter/history.go index 2b7de399a0..ed2af4637e 100644 --- a/cli/command/formatter/history.go +++ b/cli/command/formatter/history.go @@ -99,13 +99,10 @@ func (c *historyContext) CreatedBy() string { } func (c *historyContext) Size() string { - size := "" if c.human { - size = units.HumanSizeWithPrecision(float64(c.h.Size), 3) - } else { - size = strconv.FormatInt(c.h.Size, 10) + return units.HumanSizeWithPrecision(float64(c.h.Size), 3) } - return size + return strconv.FormatInt(c.h.Size, 10) } func (c *historyContext) Comment() string { diff --git a/cli/command/service/logs.go b/cli/command/service/logs.go index f64911d7fd..c4ac557021 100644 --- a/cli/command/service/logs.go +++ b/cli/command/service/logs.go @@ -92,7 +92,7 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error { if !client.IsErrServiceNotFound(err) { return err } - task, _, err := cli.TaskInspectWithRaw(ctx, opts.target) + task, _, _ := cli.TaskInspectWithRaw(ctx, opts.target) tty = task.Spec.ContainerSpec.TTY // TODO(dperny) hot fix until we get a nice details system squared away, // ignores details (including task context) if we have a TTY log @@ -112,7 +112,7 @@ func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error { return err } maxLength = getMaxLength(task.Slot) - responseBody, err = cli.TaskLogs(ctx, opts.target, options) + responseBody, _ = cli.TaskLogs(ctx, opts.target, options) } else { tty = service.Spec.TaskTemplate.ContainerSpec.TTY // TODO(dperny) hot fix until we get a nice details system squared away, diff --git a/cli/command/task/print.go b/cli/command/task/print.go index 658c0e5510..2376ecf803 100644 --- a/cli/command/task/print.go +++ b/cli/command/task/print.go @@ -59,7 +59,7 @@ func Print(ctx context.Context, dockerCli command.Cli, tasks []swarm.Task, resol return err } - name := "" + var name string if task.Slot != 0 { name = fmt.Sprintf("%v.%v", serviceName, task.Slot) } else { diff --git a/cli/config/config_test.go b/cli/config/config_test.go index 41be45ffd9..7eab2efaa3 100644 --- a/cli/config/config_test.go +++ b/cli/config/config_test.go @@ -9,6 +9,7 @@ import ( "github.com/docker/cli/cli/config/configfile" "github.com/docker/docker/pkg/homedir" + "github.com/stretchr/testify/require" ) func TestEmptyConfigDir(t *testing.T) { @@ -543,6 +544,7 @@ func TestJSONSaveWithNoFile(t *testing.T) { "psFormat": "table {{.ID}}\\t{{.Label \"com.docker.label.cpu\"}}" }` config, err := LoadFromReader(strings.NewReader(js)) + require.NoError(t, err) err = config.Save() if err == nil { t.Fatalf("Expected error. File should not have been able to save with no file name.") @@ -583,6 +585,7 @@ func TestLegacyJSONSaveWithNoFile(t *testing.T) { js := `{"https://index.docker.io/v1/":{"auth":"am9lam9lOmhlbGxv","email":"user@example.com"}}` config, err := LegacyLoadFromReader(strings.NewReader(js)) + require.NoError(t, err) err = config.Save() if err == nil { t.Fatalf("Expected error. File should not have been able to save with no file name.") diff --git a/gometalinter.json b/gometalinter.json index a04fd837b3..80d60b063f 100644 --- a/gometalinter.json +++ b/gometalinter.json @@ -5,12 +5,13 @@ "DisableAll": true, "Enable": [ - "gofmt", - "vet", - "golint", - "goimports", "deadcode", - "gocyclo" + "gocyclo", + "gofmt", + "goimports", + "golint", + "ineffassign", + "vet" ], "Cyclo": 19