mirror of https://github.com/docker/cli.git
Add ineffassign linter.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
08af0f28c5
commit
b86533c479
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.")
|
||||
|
|
|
@ -5,12 +5,13 @@
|
|||
|
||||
"DisableAll": true,
|
||||
"Enable": [
|
||||
"gofmt",
|
||||
"vet",
|
||||
"golint",
|
||||
"goimports",
|
||||
"deadcode",
|
||||
"gocyclo"
|
||||
"gocyclo",
|
||||
"gofmt",
|
||||
"goimports",
|
||||
"golint",
|
||||
"ineffassign",
|
||||
"vet"
|
||||
],
|
||||
|
||||
"Cyclo": 19
|
||||
|
|
Loading…
Reference in New Issue