mirror of https://github.com/docker/cli.git
Update gometalinter
and enable the new WarnUnmatchedDirective to warn if a nolint is unnecessary. remove some unnecessary nolint Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
b68c3d007f
commit
c0d004f7cf
|
@ -8,8 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewConfigCommand returns a cobra command for `config` subcommands
|
// NewConfigCommand returns a cobra command for `config` subcommands
|
||||||
// nolint: interfacer
|
func NewConfigCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewConfigCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "config",
|
Use: "config",
|
||||||
Short: "Manage Docker configs",
|
Short: "Manage Docker configs",
|
||||||
|
|
|
@ -7,8 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewContainerCommand returns a cobra command for `container` subcommands
|
// NewContainerCommand returns a cobra command for `container` subcommands
|
||||||
// nolint: interfacer
|
func NewContainerCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewContainerCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "container",
|
Use: "container",
|
||||||
Short: "Manage containers",
|
Short: "Manage containers",
|
||||||
|
|
|
@ -22,7 +22,7 @@ type commitOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCommitCommand creates a new cobra.Command for `docker commit`
|
// NewCommitCommand creates a new cobra.Command for `docker commit`
|
||||||
func NewCommitCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewCommitCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var options commitOptions
|
var options commitOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -51,7 +51,7 @@ func NewCommitCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCommit(dockerCli *command.DockerCli, options *commitOptions) error {
|
func runCommit(dockerCli command.Cli, options *commitOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
name := options.container
|
name := options.container
|
||||||
|
|
|
@ -36,7 +36,7 @@ type cpConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewCopyCommand creates a new `docker cp` command
|
// NewCopyCommand creates a new `docker cp` command
|
||||||
func NewCopyCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewCopyCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts copyOptions
|
var opts copyOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -72,7 +72,7 @@ func NewCopyCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCopy(dockerCli *command.DockerCli, opts copyOptions) error {
|
func runCopy(dockerCli command.Cli, opts copyOptions) error {
|
||||||
srcContainer, srcPath := splitCpArg(opts.source)
|
srcContainer, srcPath := splitCpArg(opts.source)
|
||||||
dstContainer, dstPath := splitCpArg(opts.destination)
|
dstContainer, dstPath := splitCpArg(opts.destination)
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ func runCopy(dockerCli *command.DockerCli, opts copyOptions) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func statContainerPath(ctx context.Context, dockerCli *command.DockerCli, containerName, path string) (types.ContainerPathStat, error) {
|
func statContainerPath(ctx context.Context, dockerCli command.Cli, containerName, path string) (types.ContainerPathStat, error) {
|
||||||
return dockerCli.Client().ContainerStatPath(ctx, containerName, path)
|
return dockerCli.Client().ContainerStatPath(ctx, containerName, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ func resolveLocalPath(localPath string) (absPath string, err error) {
|
||||||
return archive.PreserveTrailingDotOrSeparator(absPath, localPath, filepath.Separator), nil
|
return archive.PreserveTrailingDotOrSeparator(absPath, localPath, filepath.Separator), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyFromContainer(ctx context.Context, dockerCli *command.DockerCli, srcContainer, srcPath, dstPath string, cpParam *cpConfig) (err error) {
|
func copyFromContainer(ctx context.Context, dockerCli command.Cli, srcContainer, srcPath, dstPath string, cpParam *cpConfig) (err error) {
|
||||||
if dstPath != "-" {
|
if dstPath != "-" {
|
||||||
// Get an absolute destination path.
|
// Get an absolute destination path.
|
||||||
dstPath, err = resolveLocalPath(dstPath)
|
dstPath, err = resolveLocalPath(dstPath)
|
||||||
|
@ -177,7 +177,7 @@ func copyFromContainer(ctx context.Context, dockerCli *command.DockerCli, srcCon
|
||||||
return archive.CopyTo(preArchive, srcInfo, dstPath)
|
return archive.CopyTo(preArchive, srcInfo, dstPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
func copyToContainer(ctx context.Context, dockerCli *command.DockerCli, srcPath, dstContainer, dstPath string, cpParam *cpConfig, copyUIDGID bool) (err error) {
|
func copyToContainer(ctx context.Context, dockerCli command.Cli, srcPath, dstContainer, dstPath string, cpParam *cpConfig, copyUIDGID bool) (err error) {
|
||||||
if srcPath != "-" {
|
if srcPath != "-" {
|
||||||
// Get an absolute source path.
|
// Get an absolute source path.
|
||||||
srcPath, err = resolveLocalPath(srcPath)
|
srcPath, err = resolveLocalPath(srcPath)
|
||||||
|
|
|
@ -14,7 +14,7 @@ type diffOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDiffCommand creates a new cobra.Command for `docker diff`
|
// NewDiffCommand creates a new cobra.Command for `docker diff`
|
||||||
func NewDiffCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewDiffCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts diffOptions
|
var opts diffOptions
|
||||||
|
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
|
@ -28,7 +28,7 @@ func NewDiffCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDiff(dockerCli *command.DockerCli, opts *diffOptions) error {
|
func runDiff(dockerCli command.Cli, opts *diffOptions) error {
|
||||||
if opts.container == "" {
|
if opts.container == "" {
|
||||||
return errors.New("Container name cannot be empty")
|
return errors.New("Container name cannot be empty")
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ type exportOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewExportCommand creates a new `docker export` command
|
// NewExportCommand creates a new `docker export` command
|
||||||
func NewExportCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewExportCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts exportOptions
|
var opts exportOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -36,7 +36,7 @@ func NewExportCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runExport(dockerCli *command.DockerCli, opts exportOptions) error {
|
func runExport(dockerCli command.Cli, 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")
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ type inspectOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// newInspectCommand creates a new cobra.Command for `docker container inspect`
|
// newInspectCommand creates a new cobra.Command for `docker container inspect`
|
||||||
func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts inspectOptions
|
var opts inspectOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -35,7 +35,7 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
|
func runInspect(dockerCli command.Cli, opts inspectOptions) error {
|
||||||
client := dockerCli.Client()
|
client := dockerCli.Client()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ type killOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewKillCommand creates a new cobra.Command for `docker kill`
|
// NewKillCommand creates a new cobra.Command for `docker kill`
|
||||||
func NewKillCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewKillCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts killOptions
|
var opts killOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -36,7 +36,7 @@ func NewKillCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runKill(dockerCli *command.DockerCli, opts *killOptions) error {
|
func runKill(dockerCli command.Cli, opts *killOptions) error {
|
||||||
var errs []string
|
var errs []string
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error {
|
errChan := parallelOperation(ctx, opts.containers, func(ctx context.Context, container string) error {
|
||||||
|
|
|
@ -25,7 +25,7 @@ type psOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPsCommand creates a new cobra.Command for `docker ps`
|
// NewPsCommand creates a new cobra.Command for `docker ps`
|
||||||
func NewPsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewPsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
options := psOptions{filter: opts.NewFilterOpt()}
|
options := psOptions{filter: opts.NewFilterOpt()}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -51,7 +51,7 @@ func NewPsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
cmd := *NewPsCommand(dockerCli)
|
cmd := *NewPsCommand(dockerCli)
|
||||||
cmd.Aliases = []string{"ps", "list"}
|
cmd.Aliases = []string{"ps", "list"}
|
||||||
cmd.Use = "ls [OPTIONS]"
|
cmd.Use = "ls [OPTIONS]"
|
||||||
|
@ -109,7 +109,7 @@ func buildContainerListOptions(opts *psOptions) (*types.ContainerListOptions, er
|
||||||
return options, nil
|
return options, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPs(dockerCli *command.DockerCli, options *psOptions) error {
|
func runPs(dockerCli command.Cli, options *psOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
listOptions, err := buildContainerListOptions(options)
|
listOptions, err := buildContainerListOptions(options)
|
||||||
|
|
|
@ -22,7 +22,7 @@ type logsOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLogsCommand creates a new cobra.Command for `docker logs`
|
// NewLogsCommand creates a new cobra.Command for `docker logs`
|
||||||
func NewLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewLogsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts logsOptions
|
var opts logsOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -44,7 +44,7 @@ func NewLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
options := types.ContainerLogsOptions{
|
options := types.ContainerLogsOptions{
|
||||||
|
|
|
@ -16,7 +16,7 @@ type pauseOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPauseCommand creates a new cobra.Command for `docker pause`
|
// NewPauseCommand creates a new cobra.Command for `docker pause`
|
||||||
func NewPauseCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewPauseCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts pauseOptions
|
var opts pauseOptions
|
||||||
|
|
||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
|
@ -30,7 +30,7 @@ func NewPauseCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPause(dockerCli *command.DockerCli, opts *pauseOptions) error {
|
func runPause(dockerCli command.Cli, opts *pauseOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
|
|
|
@ -19,7 +19,7 @@ type portOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewPortCommand creates a new cobra.Command for `docker port`
|
// NewPortCommand creates a new cobra.Command for `docker port`
|
||||||
func NewPortCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewPortCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts portOptions
|
var opts portOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -37,7 +37,7 @@ func NewPortCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runPort(dockerCli *command.DockerCli, opts *portOptions) error {
|
func runPort(dockerCli command.Cli, opts *portOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container)
|
c, err := dockerCli.Client().ContainerInspect(ctx, opts.container)
|
||||||
|
|
|
@ -17,7 +17,7 @@ type renameOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRenameCommand creates a new cobra.Command for `docker rename`
|
// NewRenameCommand creates a new cobra.Command for `docker rename`
|
||||||
func NewRenameCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewRenameCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts renameOptions
|
var opts renameOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -33,7 +33,7 @@ func NewRenameCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRename(dockerCli *command.DockerCli, opts *renameOptions) error {
|
func runRename(dockerCli command.Cli, opts *renameOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
oldName := strings.TrimSpace(opts.oldName)
|
oldName := strings.TrimSpace(opts.oldName)
|
||||||
|
|
|
@ -20,7 +20,7 @@ type restartOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRestartCommand creates a new cobra.Command for `docker restart`
|
// NewRestartCommand creates a new cobra.Command for `docker restart`
|
||||||
func NewRestartCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewRestartCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts restartOptions
|
var opts restartOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -39,7 +39,7 @@ func NewRestartCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRestart(dockerCli *command.DockerCli, opts *restartOptions) error {
|
func runRestart(dockerCli command.Cli, opts *restartOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
var errs []string
|
var errs []string
|
||||||
var timeout *time.Duration
|
var timeout *time.Duration
|
||||||
|
|
|
@ -21,7 +21,7 @@ type rmOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRmCommand creates a new cobra.Command for `docker rm`
|
// NewRmCommand creates a new cobra.Command for `docker rm`
|
||||||
func NewRmCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewRmCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts rmOptions
|
var opts rmOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -41,7 +41,7 @@ func NewRmCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRm(dockerCli *command.DockerCli, opts *rmOptions) error {
|
func runRm(dockerCli command.Cli, opts *rmOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
|
|
|
@ -32,7 +32,7 @@ type runOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRunCommand create a new `docker run` command
|
// NewRunCommand create a new `docker run` command
|
||||||
func NewRunCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewRunCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts runOptions
|
var opts runOptions
|
||||||
var copts *containerOptions
|
var copts *containerOptions
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ func isLocalhost(ip string) bool {
|
||||||
return localhostIPRegexp.MatchString(ip)
|
return localhostIPRegexp.MatchString(ip)
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRun(dockerCli *command.DockerCli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions) error {
|
func runRun(dockerCli command.Cli, flags *pflag.FlagSet, ropts *runOptions, copts *containerOptions) error {
|
||||||
proxyConfig := dockerCli.ConfigFile().ParseProxyConfig(dockerCli.Client().DaemonHost(), copts.env.GetAll())
|
proxyConfig := dockerCli.ConfigFile().ParseProxyConfig(dockerCli.Client().DaemonHost(), copts.env.GetAll())
|
||||||
newEnv := []string{}
|
newEnv := []string{}
|
||||||
for k, v := range proxyConfig {
|
for k, v := range proxyConfig {
|
||||||
|
@ -117,7 +117,7 @@ func runRun(dockerCli *command.DockerCli, flags *pflag.FlagSet, ropts *runOption
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: gocyclo
|
// nolint: gocyclo
|
||||||
func runContainer(dockerCli *command.DockerCli, opts *runOptions, copts *containerOptions, containerConfig *containerConfig) error {
|
func runContainer(dockerCli command.Cli, opts *runOptions, copts *containerOptions, containerConfig *containerConfig) error {
|
||||||
config := containerConfig.Config
|
config := containerConfig.Config
|
||||||
hostConfig := containerConfig.HostConfig
|
hostConfig := containerConfig.HostConfig
|
||||||
stdout, stderr := dockerCli.Out(), dockerCli.Err()
|
stdout, stderr := dockerCli.Out(), dockerCli.Err()
|
||||||
|
|
|
@ -27,7 +27,7 @@ type startOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStartCommand creates a new cobra.Command for `docker start`
|
// NewStartCommand creates a new cobra.Command for `docker start`
|
||||||
func NewStartCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewStartCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts startOptions
|
var opts startOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -53,7 +53,7 @@ func NewStartCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: gocyclo
|
// nolint: gocyclo
|
||||||
func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
|
func runStart(dockerCli command.Cli, opts *startOptions) error {
|
||||||
ctx, cancelFun := context.WithCancel(context.Background())
|
ctx, cancelFun := context.WithCancel(context.Background())
|
||||||
|
|
||||||
if opts.attach || opts.openStdin {
|
if opts.attach || opts.openStdin {
|
||||||
|
@ -181,7 +181,7 @@ func runStart(dockerCli *command.DockerCli, opts *startOptions) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func startContainersWithoutAttachments(ctx context.Context, dockerCli *command.DockerCli, containers []string) error {
|
func startContainersWithoutAttachments(ctx context.Context, dockerCli command.Cli, containers []string) error {
|
||||||
var failedContainers []string
|
var failedContainers []string
|
||||||
for _, container := range containers {
|
for _, container := range containers {
|
||||||
if err := dockerCli.Client().ContainerStart(ctx, container, types.ContainerStartOptions{}); err != nil {
|
if err := dockerCli.Client().ContainerStart(ctx, container, types.ContainerStartOptions{}); err != nil {
|
||||||
|
|
|
@ -27,7 +27,7 @@ type statsOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStatsCommand creates a new cobra.Command for `docker stats`
|
// NewStatsCommand creates a new cobra.Command for `docker stats`
|
||||||
func NewStatsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewStatsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts statsOptions
|
var opts statsOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -51,7 +51,7 @@ func NewStatsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
// runStats displays a live stream of resource usage statistics for one or more containers.
|
// runStats displays a live stream of resource usage statistics for one or more containers.
|
||||||
// This shows real-time information on CPU usage, memory usage, and network I/O.
|
// This shows real-time information on CPU usage, memory usage, and network I/O.
|
||||||
// nolint: gocyclo
|
// nolint: gocyclo
|
||||||
func runStats(dockerCli *command.DockerCli, opts *statsOptions) error {
|
func runStats(dockerCli command.Cli, opts *statsOptions) error {
|
||||||
showAll := len(opts.containers) == 0
|
showAll := len(opts.containers) == 0
|
||||||
closeChan := make(chan error)
|
closeChan := make(chan error)
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ type stopOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStopCommand creates a new cobra.Command for `docker stop`
|
// NewStopCommand creates a new cobra.Command for `docker stop`
|
||||||
func NewStopCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewStopCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts stopOptions
|
var opts stopOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -39,7 +39,7 @@ func NewStopCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runStop(dockerCli *command.DockerCli, opts *stopOptions) error {
|
func runStop(dockerCli command.Cli, opts *stopOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var timeout *time.Duration
|
var timeout *time.Duration
|
||||||
|
|
|
@ -18,7 +18,7 @@ type topOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewTopCommand creates a new cobra.Command for `docker top`
|
// NewTopCommand creates a new cobra.Command for `docker top`
|
||||||
func NewTopCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewTopCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts topOptions
|
var opts topOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -38,7 +38,7 @@ func NewTopCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runTop(dockerCli *command.DockerCli, opts *topOptions) error {
|
func runTop(dockerCli command.Cli, opts *topOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
procList, err := dockerCli.Client().ContainerTop(ctx, opts.container, opts.args)
|
procList, err := dockerCli.Client().ContainerTop(ctx, opts.container, opts.args)
|
||||||
|
|
|
@ -16,7 +16,7 @@ type unpauseOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUnpauseCommand creates a new cobra.Command for `docker unpause`
|
// NewUnpauseCommand creates a new cobra.Command for `docker unpause`
|
||||||
func NewUnpauseCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewUnpauseCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts unpauseOptions
|
var opts unpauseOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -31,7 +31,7 @@ func NewUnpauseCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runUnpause(dockerCli *command.DockerCli, opts *unpauseOptions) error {
|
func runUnpause(dockerCli command.Cli, opts *unpauseOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
|
|
|
@ -35,7 +35,7 @@ type updateOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUpdateCommand creates a new cobra.Command for `docker update`
|
// NewUpdateCommand creates a new cobra.Command for `docker update`
|
||||||
func NewUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewUpdateCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var options updateOptions
|
var options updateOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -72,7 +72,7 @@ func NewUpdateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runUpdate(dockerCli *command.DockerCli, options *updateOptions) error {
|
func runUpdate(dockerCli command.Cli, options *updateOptions) error {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
if options.nFlag == 0 {
|
if options.nFlag == 0 {
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func waitExitOrRemoved(ctx context.Context, dockerCli *command.DockerCli, containerID string, waitRemove bool) <-chan int {
|
func waitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID string, waitRemove bool) <-chan int {
|
||||||
if len(containerID) == 0 {
|
if len(containerID) == 0 {
|
||||||
// containerID can never be empty
|
// containerID can never be empty
|
||||||
panic("Internal Error: waitExitOrRemoved needs a containerID as parameter")
|
panic("Internal Error: waitExitOrRemoved needs a containerID as parameter")
|
||||||
|
@ -47,7 +47,7 @@ func waitExitOrRemoved(ctx context.Context, dockerCli *command.DockerCli, contai
|
||||||
return statusC
|
return statusC
|
||||||
}
|
}
|
||||||
|
|
||||||
func legacyWaitExitOrRemoved(ctx context.Context, dockerCli *command.DockerCli, containerID string, waitRemove bool) <-chan int {
|
func legacyWaitExitOrRemoved(ctx context.Context, dockerCli command.Cli, containerID string, waitRemove bool) <-chan int {
|
||||||
var removeErr error
|
var removeErr error
|
||||||
statusChan := make(chan int)
|
statusChan := make(chan int)
|
||||||
exitCode := 125
|
exitCode := 125
|
||||||
|
|
|
@ -16,7 +16,7 @@ type waitOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWaitCommand creates a new cobra.Command for `docker wait`
|
// NewWaitCommand creates a new cobra.Command for `docker wait`
|
||||||
func NewWaitCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewWaitCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts waitOptions
|
var opts waitOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -32,7 +32,7 @@ func NewWaitCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runWait(dockerCli *command.DockerCli, opts *waitOptions) error {
|
func runWait(dockerCli command.Cli, opts *waitOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs []string
|
var errs []string
|
||||||
|
|
|
@ -7,8 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewPluginCommand returns a cobra command for `plugin` subcommands
|
// NewPluginCommand returns a cobra command for `plugin` subcommands
|
||||||
// nolint: interfacer
|
func NewPluginCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewPluginCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "plugin",
|
Use: "plugin",
|
||||||
Short: "Manage plugins",
|
Short: "Manage plugins",
|
||||||
|
|
|
@ -63,7 +63,7 @@ type pluginCreateOptions struct {
|
||||||
compress bool
|
compress bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newCreateCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
options := pluginCreateOptions{}
|
options := pluginCreateOptions{}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -84,7 +84,7 @@ func newCreateCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runCreate(dockerCli *command.DockerCli, options pluginCreateOptions) error {
|
func runCreate(dockerCli command.Cli, options pluginCreateOptions) error {
|
||||||
var (
|
var (
|
||||||
createCtx io.ReadCloser
|
createCtx io.ReadCloser
|
||||||
err error
|
err error
|
||||||
|
|
|
@ -10,7 +10,7 @@ import (
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newDisableCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newDisableCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var force bool
|
var force bool
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -27,7 +27,7 @@ func newDisableCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDisable(dockerCli *command.DockerCli, name string, force bool) error {
|
func runDisable(dockerCli command.Cli, name string, force bool) error {
|
||||||
if err := dockerCli.Client().PluginDisable(context.Background(), name, types.PluginDisableOptions{Force: force}); err != nil {
|
if err := dockerCli.Client().PluginDisable(context.Background(), name, types.PluginDisableOptions{Force: force}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ type enableOpts struct {
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newEnableCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newEnableCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts enableOpts
|
var opts enableOpts
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -34,7 +34,7 @@ func newEnableCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runEnable(dockerCli *command.DockerCli, opts *enableOpts) error {
|
func runEnable(dockerCli command.Cli, opts *enableOpts) error {
|
||||||
name := opts.name
|
name := opts.name
|
||||||
if opts.timeout < 0 {
|
if opts.timeout < 0 {
|
||||||
return errors.Errorf("negative timeout %d is invalid", opts.timeout)
|
return errors.Errorf("negative timeout %d is invalid", opts.timeout)
|
||||||
|
|
|
@ -13,7 +13,7 @@ type inspectOptions struct {
|
||||||
format string
|
format string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newInspectCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts inspectOptions
|
var opts inspectOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -31,7 +31,7 @@ func newInspectCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInspect(dockerCli *command.DockerCli, opts inspectOptions) error {
|
func runInspect(dockerCli command.Cli, opts inspectOptions) error {
|
||||||
client := dockerCli.Client()
|
client := dockerCli.Client()
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
getRef := func(ref string) (interface{}, []byte, error) {
|
getRef := func(ref string) (interface{}, []byte, error) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ func loadPullFlags(opts *pluginOptions, flags *pflag.FlagSet) {
|
||||||
command.AddTrustVerificationFlags(flags)
|
command.AddTrustVerificationFlags(flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
func newInstallCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newInstallCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var options pluginOptions
|
var options pluginOptions
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "install [OPTIONS] PLUGIN [KEY=VALUE...]",
|
Use: "install [OPTIONS] PLUGIN [KEY=VALUE...]",
|
||||||
|
@ -73,7 +73,7 @@ func newRegistryService() (registry.Service, error) {
|
||||||
return pluginRegistryService{Service: svc}, nil
|
return pluginRegistryService{Service: svc}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildPullConfig(ctx context.Context, dockerCli *command.DockerCli, opts pluginOptions, cmdName string) (types.PluginInstallOptions, error) {
|
func buildPullConfig(ctx context.Context, dockerCli command.Cli, opts pluginOptions, cmdName string) (types.PluginInstallOptions, error) {
|
||||||
// Names with both tag and digest will be treated by the daemon
|
// Names with both tag and digest will be treated by the daemon
|
||||||
// as a pull by digest with a local name for the tag
|
// as a pull by digest with a local name for the tag
|
||||||
// (if no local name is provided).
|
// (if no local name is provided).
|
||||||
|
@ -130,7 +130,7 @@ func buildPullConfig(ctx context.Context, dockerCli *command.DockerCli, opts plu
|
||||||
return options, nil
|
return options, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error {
|
func runInstall(dockerCli command.Cli, opts pluginOptions) error {
|
||||||
var localName string
|
var localName string
|
||||||
if opts.localName != "" {
|
if opts.localName != "" {
|
||||||
aref, err := reference.ParseNormalizedNamed(opts.localName)
|
aref, err := reference.ParseNormalizedNamed(opts.localName)
|
||||||
|
@ -163,7 +163,7 @@ func runInstall(dockerCli *command.DockerCli, opts pluginOptions) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func acceptPrivileges(dockerCli *command.DockerCli, name string) func(privileges types.PluginPrivileges) (bool, error) {
|
func acceptPrivileges(dockerCli command.Cli, name string) func(privileges types.PluginPrivileges) (bool, error) {
|
||||||
return func(privileges types.PluginPrivileges) (bool, error) {
|
return func(privileges types.PluginPrivileges) (bool, error) {
|
||||||
fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name)
|
fmt.Fprintf(dockerCli.Out(), "Plugin %q is requesting the following privileges:\n", name)
|
||||||
for _, privilege := range privileges {
|
for _, privilege := range privileges {
|
||||||
|
|
|
@ -16,7 +16,7 @@ type listOptions struct {
|
||||||
filter opts.FilterOpt
|
filter opts.FilterOpt
|
||||||
}
|
}
|
||||||
|
|
||||||
func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newListCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
options := listOptions{filter: opts.NewFilterOpt()}
|
options := listOptions{filter: opts.NewFilterOpt()}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -39,7 +39,7 @@ func newListCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runList(dockerCli *command.DockerCli, options listOptions) error {
|
func runList(dockerCli command.Cli, options listOptions) error {
|
||||||
plugins, err := dockerCli.Client().PluginList(context.Background(), options.filter.Value())
|
plugins, err := dockerCli.Client().PluginList(context.Background(), options.filter.Value())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -16,7 +16,7 @@ type rmOptions struct {
|
||||||
plugins []string
|
plugins []string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newRemoveCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts rmOptions
|
var opts rmOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -35,7 +35,7 @@ func newRemoveCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRemove(dockerCli *command.DockerCli, opts *rmOptions) error {
|
func runRemove(dockerCli command.Cli, opts *rmOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
var errs cli.Errors
|
var errs cli.Errors
|
||||||
|
|
|
@ -8,7 +8,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newSetCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newSetCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "set PLUGIN KEY=VALUE [KEY=VALUE...]",
|
Use: "set PLUGIN KEY=VALUE [KEY=VALUE...]",
|
||||||
Short: "Change settings for a plugin",
|
Short: "Change settings for a plugin",
|
||||||
|
|
|
@ -13,7 +13,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
func newUpgradeCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newUpgradeCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var options pluginOptions
|
var options pluginOptions
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "upgrade [OPTIONS] PLUGIN [REMOTE]",
|
Use: "upgrade [OPTIONS] PLUGIN [REMOTE]",
|
||||||
|
@ -35,7 +35,7 @@ func newUpgradeCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runUpgrade(dockerCli *command.DockerCli, opts pluginOptions) error {
|
func runUpgrade(dockerCli command.Cli, opts pluginOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
p, _, err := dockerCli.Client().PluginInspectWithRaw(ctx, opts.localName)
|
p, _, err := dockerCli.Client().PluginInspectWithRaw(ctx, opts.localName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -8,8 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSecretCommand returns a cobra command for `secret` subcommands
|
// NewSecretCommand returns a cobra command for `secret` subcommands
|
||||||
// nolint: interfacer
|
func NewSecretCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewSecretCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "secret",
|
Use: "secret",
|
||||||
Short: "Manage Docker secrets",
|
Short: "Manage Docker secrets",
|
||||||
|
|
|
@ -8,8 +8,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewServiceCommand returns a cobra command for `service` subcommands
|
// NewServiceCommand returns a cobra command for `service` subcommands
|
||||||
// nolint: interfacer
|
func NewServiceCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewServiceCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "service",
|
Use: "service",
|
||||||
Short: "Manage services",
|
Short: "Manage services",
|
||||||
|
|
|
@ -37,7 +37,7 @@ type logsOptions struct {
|
||||||
target string
|
target string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newLogsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts logsOptions
|
var opts logsOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -68,7 +68,7 @@ func newLogsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runLogs(dockerCli *command.DockerCli, opts *logsOptions) error {
|
func runLogs(dockerCli command.Cli, opts *logsOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
options := types.ContainerLogsOptions{
|
options := types.ContainerLogsOptions{
|
||||||
|
|
|
@ -354,7 +354,7 @@ func convertNetworks(ctx context.Context, apiClient client.NetworkAPIClient, net
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
netAttach = append(netAttach, swarm.NetworkAttachmentConfig{ // nolint: gosimple
|
netAttach = append(netAttach, swarm.NetworkAttachmentConfig{
|
||||||
Target: net.Target,
|
Target: net.Target,
|
||||||
Aliases: net.Aliases,
|
Aliases: net.Aliases,
|
||||||
DriverOpts: net.DriverOpts,
|
DriverOpts: net.DriverOpts,
|
||||||
|
|
|
@ -7,8 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewStackCommand returns a cobra command for `stack` subcommands
|
// NewStackCommand returns a cobra command for `stack` subcommands
|
||||||
// nolint: interfacer
|
func NewStackCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewStackCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "stack",
|
Use: "stack",
|
||||||
Short: "Manage Docker stacks",
|
Short: "Manage Docker stacks",
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSwarmCommand returns a cobra command for `swarm` subcommands
|
// NewSwarmCommand returns a cobra command for `swarm` subcommands
|
||||||
// nolint: interfacer
|
|
||||||
func NewSwarmCommand(dockerCli command.Cli) *cobra.Command {
|
func NewSwarmCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "swarm",
|
Use: "swarm",
|
||||||
|
|
|
@ -7,8 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewSystemCommand returns a cobra command for `system` subcommands
|
// NewSystemCommand returns a cobra command for `system` subcommands
|
||||||
// nolint: interfacer
|
func NewSystemCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
func NewSystemCommand(dockerCli *command.DockerCli) *cobra.Command {
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
Use: "system",
|
Use: "system",
|
||||||
Short: "Manage Docker",
|
Short: "Manage Docker",
|
||||||
|
|
|
@ -16,7 +16,7 @@ type diskUsageOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// newDiskUsageCommand creates a new cobra.Command for `docker df`
|
// newDiskUsageCommand creates a new cobra.Command for `docker df`
|
||||||
func newDiskUsageCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func newDiskUsageCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts diskUsageOptions
|
var opts diskUsageOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -37,7 +37,7 @@ func newDiskUsageCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runDiskUsage(dockerCli *command.DockerCli, opts diskUsageOptions) error {
|
func runDiskUsage(dockerCli command.Cli, opts diskUsageOptions) error {
|
||||||
if opts.verbose && len(opts.format) != 0 {
|
if opts.verbose && len(opts.format) != 0 {
|
||||||
return errors.New("the verbose and the format options conflict")
|
return errors.New("the verbose and the format options conflict")
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ type eventsOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewEventsCommand creates a new cobra.Command for `docker events`
|
// NewEventsCommand creates a new cobra.Command for `docker events`
|
||||||
func NewEventsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewEventsCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
options := eventsOptions{filter: opts.NewFilterOpt()}
|
options := eventsOptions{filter: opts.NewFilterOpt()}
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -48,7 +48,7 @@ func NewEventsCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runEvents(dockerCli *command.DockerCli, options *eventsOptions) error {
|
func runEvents(dockerCli command.Cli, options *eventsOptions) error {
|
||||||
tmpl, err := makeTemplate(options.format)
|
tmpl, err := makeTemplate(options.format)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.StatusError{
|
return cli.StatusError{
|
||||||
|
|
|
@ -22,7 +22,7 @@ type infoOptions struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInfoCommand creates a new cobra.Command for `docker info`
|
// NewInfoCommand creates a new cobra.Command for `docker info`
|
||||||
func NewInfoCommand(dockerCli *command.DockerCli) *cobra.Command {
|
func NewInfoCommand(dockerCli command.Cli) *cobra.Command {
|
||||||
var opts infoOptions
|
var opts infoOptions
|
||||||
|
|
||||||
cmd := &cobra.Command{
|
cmd := &cobra.Command{
|
||||||
|
@ -41,7 +41,7 @@ func NewInfoCommand(dockerCli *command.DockerCli) *cobra.Command {
|
||||||
return cmd
|
return cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
func runInfo(dockerCli *command.DockerCli, opts *infoOptions) error {
|
func runInfo(dockerCli command.Cli, opts *infoOptions) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
info, err := dockerCli.Client().Info(ctx)
|
info, err := dockerCli.Client().Info(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -357,7 +357,7 @@ func getBackingFs(info types.Info) string {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatInfo(dockerCli *command.DockerCli, info types.Info, format string) error {
|
func formatInfo(dockerCli command.Cli, info types.Info, format string) error {
|
||||||
tmpl, err := templates.Parse(format)
|
tmpl, err := templates.Parse(format)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cli.StatusError{StatusCode: 64,
|
return cli.StatusError{StatusCode: 64,
|
||||||
|
|
|
@ -2,7 +2,7 @@ FROM golang:1.8.4-alpine
|
||||||
|
|
||||||
RUN apk add -U git
|
RUN apk add -U git
|
||||||
|
|
||||||
ARG GOMETALINTER_SHA=8eca55135021737bbc65ed68b548b3336853274c
|
ARG GOMETALINTER_SHA=7f9672e7ea538b8682e83395d50b12f09bb17b91
|
||||||
RUN go get -d github.com/alecthomas/gometalinter && \
|
RUN go get -d github.com/alecthomas/gometalinter && \
|
||||||
cd /go/src/github.com/alecthomas/gometalinter && \
|
cd /go/src/github.com/alecthomas/gometalinter && \
|
||||||
git checkout -q "$GOMETALINTER_SHA" && \
|
git checkout -q "$GOMETALINTER_SHA" && \
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"Pattern": "^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$"
|
"Pattern": "^(?P<path>.*?\\.go):(?P<line>\\d+)\\s*(?P<message>.*)$"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"WarnUnmatchedDirective": true,
|
||||||
|
|
||||||
"DisableAll": true,
|
"DisableAll": true,
|
||||||
"Enable": [
|
"Enable": [
|
||||||
|
|
Loading…
Reference in New Issue