Skip to content

Commit 8403869

Browse files
authored
Merge pull request docker#6158 from thaJeztah/reduce_strslice
cli/command/container: remove redundant uses of strslice.StrSlice
2 parents 1fc7194 + e7e238e commit 8403869

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

cli/command/container/opts.go

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"github.com/docker/docker/api/types/container"
1919
mounttypes "github.com/docker/docker/api/types/mount"
2020
networktypes "github.com/docker/docker/api/types/network"
21-
"github.com/docker/docker/api/types/strslice"
2221
"github.com/docker/go-connections/nat"
2322
"github.com/pkg/errors"
2423
"github.com/spf13/pflag"
@@ -400,17 +399,14 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
400399
tmpfs[k] = v
401400
}
402401

403-
var (
404-
runCmd strslice.StrSlice
405-
entrypoint strslice.StrSlice
406-
)
402+
var runCmd, entrypoint []string
407403

408404
if len(copts.Args) > 0 {
409405
runCmd = copts.Args
410406
}
411407

412408
if copts.entrypoint != "" {
413-
entrypoint = strslice.StrSlice{copts.entrypoint}
409+
entrypoint = []string{copts.entrypoint}
414410
} else if flags.Changed("entrypoint") {
415411
// if `--entrypoint=` is parsed then Entrypoint is reset
416412
entrypoint = []string{""}
@@ -551,9 +547,9 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
551547
if haveHealthSettings {
552548
return nil, errors.Errorf("--no-healthcheck conflicts with --health-* options")
553549
}
554-
healthConfig = &container.HealthConfig{Test: strslice.StrSlice{"NONE"}}
550+
healthConfig = &container.HealthConfig{Test: []string{"NONE"}}
555551
} else if haveHealthSettings {
556-
var probe strslice.StrSlice
552+
var probe []string
557553
if copts.healthCmd != "" {
558554
probe = []string{"CMD-SHELL", copts.healthCmd}
559555
}
@@ -675,8 +671,8 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
675671
UTSMode: utsMode,
676672
UsernsMode: usernsMode,
677673
CgroupnsMode: cgroupnsMode,
678-
CapAdd: strslice.StrSlice(copts.capAdd.GetSlice()),
679-
CapDrop: strslice.StrSlice(copts.capDrop.GetSlice()),
674+
CapAdd: copts.capAdd.GetSlice(),
675+
CapDrop: copts.capDrop.GetSlice(),
680676
GroupAdd: copts.groupAdd.GetSlice(),
681677
RestartPolicy: restartPolicy,
682678
SecurityOpt: securityOpts,

0 commit comments

Comments
 (0)