mirror of https://github.com/docker/cli.git
Enable golint
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
0a613971b9
commit
690ef8af79
|
@ -38,7 +38,7 @@ func NewExportCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
|
|
||||||
func runExport(dockerCli *command.DockerCli, opts exportOptions) error {
|
func runExport(dockerCli *command.DockerCli, opts exportOptions) error {
|
||||||
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
||||||
return errors.New("Cowardly refusing to save to a terminal. Use the -o flag or redirect.")
|
return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect")
|
||||||
}
|
}
|
||||||
|
|
||||||
clnt := dockerCli.Client()
|
clnt := dockerCli.Client()
|
||||||
|
|
|
@ -59,7 +59,7 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
|
||||||
// We're going to attach to a container.
|
// We're going to attach to a container.
|
||||||
// 1. Ensure we only have one container.
|
// 1. Ensure we only have one container.
|
||||||
if len(opts.containers) > 1 {
|
if len(opts.containers) > 1 {
|
||||||
return errors.New("You cannot start and attach multiple containers at once.")
|
return errors.New("you cannot start and attach multiple containers at once")
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Attach to the container.
|
// 2. Attach to the container.
|
||||||
|
@ -143,7 +143,7 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
|
||||||
}
|
}
|
||||||
} else if opts.checkpoint != "" {
|
} else if opts.checkpoint != "" {
|
||||||
if len(opts.containers) > 1 {
|
if len(opts.containers) > 1 {
|
||||||
return errors.New("You cannot restore multiple containers at once.")
|
return errors.New("you cannot restore multiple containers at once")
|
||||||
}
|
}
|
||||||
container := opts.containers[0]
|
container := opts.containers[0]
|
||||||
startOptions := types.ContainerStartOptions{
|
startOptions := types.ContainerStartOptions{
|
||||||
|
|
|
@ -77,7 +77,7 @@ func runUpdate(dockerCli *command.DockerCli, opts *updateOptions) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if opts.nFlag == 0 {
|
if opts.nFlag == 0 {
|
||||||
return errors.New("You must provide one or more flags when using this command.")
|
return errors.New("you must provide one or more flags when using this command")
|
||||||
}
|
}
|
||||||
|
|
||||||
var restartPolicy containertypes.RestartPolicy
|
var restartPolicy containertypes.RestartPolicy
|
||||||
|
|
|
@ -38,7 +38,7 @@ func NewSaveCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
|
|
||||||
func runSave(dockerCli *command.DockerCli, opts saveOptions) error {
|
func runSave(dockerCli *command.DockerCli, opts saveOptions) error {
|
||||||
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
if opts.output == "" && dockerCli.Out().IsTerminal() {
|
||||||
return errors.New("Cowardly refusing to save to a terminal. Use the -o flag or redirect.")
|
return errors.New("cowardly refusing to save to a terminal. Use the -o flag or redirect")
|
||||||
}
|
}
|
||||||
|
|
||||||
responseBody, err := dockerCli.Client().ImageSave(context.Background(), opts.images)
|
responseBody, err := dockerCli.Client().ImageSave(context.Background(), opts.images)
|
||||||
|
|
|
@ -96,7 +96,7 @@ func runPs(dockerCli command.Cli, opts psOptions) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(errs) == 0 || len(tasks) != 0 {
|
if len(errs) == 0 || len(tasks) != 0 {
|
||||||
if err := task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format); err != nil {
|
if err := task.Print(ctx, dockerCli, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format); err != nil {
|
||||||
errs = append(errs, err.Error())
|
errs = append(errs, err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,5 +119,5 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format)
|
return task.Print(ctx, dockerCli, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format)
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ func checkDaemonIsSwarmManager(ctx context.Context, dockerCli *command.DockerCli
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if !info.Swarm.ControlAvailable {
|
if !info.Swarm.ControlAvailable {
|
||||||
return errors.New("This node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again.")
|
return errors.New("this node is not a swarm manager. Use \"docker swarm init\" or \"docker swarm join\" to connect this node to swarm and try again")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,5 +72,5 @@ func runPS(dockerCli *command.DockerCli, opts psOptions) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return task.Print(dockerCli, ctx, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format)
|
return task.Print(ctx, dockerCli, tasks, idresolver.New(client, opts.noResolve), !opts.noTrunc, opts.quiet, format)
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ func (t tasksBySlot) Less(i, j int) bool {
|
||||||
// Print task information in a format.
|
// Print task information in a format.
|
||||||
// Besides this, command `docker node ps <node>`
|
// Besides this, command `docker node ps <node>`
|
||||||
// and `docker stack ps` will call this, too.
|
// and `docker stack ps` will call this, too.
|
||||||
func Print(dockerCli command.Cli, ctx context.Context, tasks []swarm.Task, resolver *idresolver.IDResolver, trunc, quiet bool, format string) error {
|
func Print(ctx context.Context, dockerCli command.Cli, tasks []swarm.Task, resolver *idresolver.IDResolver, trunc, quiet bool, format string) error {
|
||||||
sort.Stable(tasksBySlot(tasks))
|
sort.Stable(tasksBySlot(tasks))
|
||||||
|
|
||||||
names := map[string]string{}
|
names := map[string]string{}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"Vendor": true,
|
"Vendor": true,
|
||||||
"Sort": ["linter", "severity"],
|
"Sort": ["linter", "severity", "path"],
|
||||||
"Exclude": ["cli/compose/schema/bindata.go"],
|
"Exclude": ["cli/compose/schema/bindata.go"],
|
||||||
|
|
||||||
"DisableAll": true,
|
"DisableAll": true,
|
||||||
"Enable": ["gofmt", "vet"]
|
"Enable": ["gofmt", "vet", "golint"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue