mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
cmd/dockerd/required.go:17:24: printf: non-constant format string in call to github.com/docker/docker/vendor/github.com/pkg/errors.Errorf (govet)
return errors.Errorf("\n" + strings.TrimRight(cmd.UsageString(), "\n"))
^
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 06bfe8bab3)
Signed-off-by: Austin Vazquez <macedonv@amazon.com>
28 lines
526 B
Go
28 lines
526 B
Go
package main
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"github.com/pkg/errors"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// NoArgs validates args and returns an error if there are any args
|
|
func NoArgs(cmd *cobra.Command, args []string) error {
|
|
if len(args) == 0 {
|
|
return nil
|
|
}
|
|
|
|
if cmd.HasSubCommands() {
|
|
return errors.New("\n" + strings.TrimRight(cmd.UsageString(), "\n"))
|
|
}
|
|
|
|
return errors.Errorf(
|
|
"\"%s\" accepts no argument(s).\nSee '%s --help'.\n\nUsage: %s\n\n%s",
|
|
cmd.CommandPath(),
|
|
cmd.CommandPath(),
|
|
cmd.UseLine(),
|
|
cmd.Short,
|
|
)
|
|
}
|