diff --git a/cli/command/container/opts.go b/cli/command/container/opts.go index fd32566867..5849b26515 100644 --- a/cli/command/container/opts.go +++ b/cli/command/container/opts.go @@ -390,7 +390,7 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con ) if len(copts.Args) > 0 { - runCmd = strslice.StrSlice(copts.Args) + runCmd = copts.Args } if copts.entrypoint != "" { @@ -529,13 +529,11 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con if haveHealthSettings { return nil, errors.Errorf("--no-healthcheck conflicts with --health-* options") } - test := strslice.StrSlice{"NONE"} - healthConfig = &container.HealthConfig{Test: test} + healthConfig = &container.HealthConfig{Test: strslice.StrSlice{"NONE"}} } else if haveHealthSettings { var probe strslice.StrSlice if copts.healthCmd != "" { - args := []string{"CMD-SHELL", copts.healthCmd} - probe = strslice.StrSlice(args) + probe = []string{"CMD-SHELL", copts.healthCmd} } if copts.healthInterval < 0 { return nil, errors.Errorf("--health-interval cannot be negative") diff --git a/opts/opts.go b/opts/opts.go index 03550023b0..7cb87b72dd 100644 --- a/opts/opts.go +++ b/opts/opts.go @@ -55,7 +55,7 @@ func (opts *ListOpts) Set(value string) error { } value = v } - (*opts.values) = append((*opts.values), value) + *opts.values = append(*opts.values, value) return nil } @@ -63,7 +63,7 @@ func (opts *ListOpts) Set(value string) error { func (opts *ListOpts) Delete(key string) { for i, k := range *opts.values { if k == key { - (*opts.values) = append((*opts.values)[:i], (*opts.values)[i+1:]...) + *opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...) return } } @@ -81,7 +81,7 @@ func (opts *ListOpts) GetMap() map[string]struct{} { // GetAll returns the values of slice. func (opts *ListOpts) GetAll() []string { - return (*opts.values) + return *opts.values } // GetAllOrEmpty returns the values of the slice @@ -106,7 +106,7 @@ func (opts *ListOpts) Get(key string) bool { // Len returns the amount of element in the slice. func (opts *ListOpts) Len() int { - return len((*opts.values)) + return len(*opts.values) } // Type returns a string name for this Option type @@ -167,9 +167,9 @@ func (opts *MapOpts) Set(value string) error { } vals := strings.SplitN(value, "=", 2) if len(vals) == 1 { - (opts.values)[vals[0]] = "" + opts.values[vals[0]] = "" } else { - (opts.values)[vals[0]] = vals[1] + opts.values[vals[0]] = vals[1] } return nil } diff --git a/opts/throttledevice.go b/opts/throttledevice.go index 0bf5dd666f..773092bc0b 100644 --- a/opts/throttledevice.go +++ b/opts/throttledevice.go @@ -77,7 +77,7 @@ func (opt *ThrottledeviceOpt) Set(val string) error { } value = v } - (opt.values) = append((opt.values), value) + opt.values = append(opt.values, value) return nil } @@ -93,10 +93,7 @@ func (opt *ThrottledeviceOpt) String() string { // GetList returns a slice of pointers to ThrottleDevices. func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice { - var throttledevice []*blkiodev.ThrottleDevice - throttledevice = append(throttledevice, opt.values...) - - return throttledevice + return append([]*blkiodev.ThrottleDevice{}, opt.values...) } // Type returns the option type diff --git a/opts/weightdevice.go b/opts/weightdevice.go index f8057d0fb7..7d217ceef9 100644 --- a/opts/weightdevice.go +++ b/opts/weightdevice.go @@ -59,7 +59,7 @@ func (opt *WeightdeviceOpt) Set(val string) error { } value = v } - (opt.values) = append((opt.values), value) + opt.values = append(opt.values, value) return nil }