remove redundant conversions and braces

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2022-12-27 15:59:57 +01:00
parent 0359f8eeee
commit d84256132d
No known key found for this signature in database
GPG Key ID: 76698F39D527CE8C
4 changed files with 12 additions and 17 deletions

View File

@ -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")

View File

@ -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
}

View File

@ -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

View File

@ -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
}