mirror of https://github.com/docker/cli.git
remove redundant conversions and braces
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
0359f8eeee
commit
d84256132d
|
@ -390,7 +390,7 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
|
||||||
)
|
)
|
||||||
|
|
||||||
if len(copts.Args) > 0 {
|
if len(copts.Args) > 0 {
|
||||||
runCmd = strslice.StrSlice(copts.Args)
|
runCmd = copts.Args
|
||||||
}
|
}
|
||||||
|
|
||||||
if copts.entrypoint != "" {
|
if copts.entrypoint != "" {
|
||||||
|
@ -529,13 +529,11 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
|
||||||
if haveHealthSettings {
|
if haveHealthSettings {
|
||||||
return nil, errors.Errorf("--no-healthcheck conflicts with --health-* options")
|
return nil, errors.Errorf("--no-healthcheck conflicts with --health-* options")
|
||||||
}
|
}
|
||||||
test := strslice.StrSlice{"NONE"}
|
healthConfig = &container.HealthConfig{Test: strslice.StrSlice{"NONE"}}
|
||||||
healthConfig = &container.HealthConfig{Test: test}
|
|
||||||
} else if haveHealthSettings {
|
} else if haveHealthSettings {
|
||||||
var probe strslice.StrSlice
|
var probe strslice.StrSlice
|
||||||
if copts.healthCmd != "" {
|
if copts.healthCmd != "" {
|
||||||
args := []string{"CMD-SHELL", copts.healthCmd}
|
probe = []string{"CMD-SHELL", copts.healthCmd}
|
||||||
probe = strslice.StrSlice(args)
|
|
||||||
}
|
}
|
||||||
if copts.healthInterval < 0 {
|
if copts.healthInterval < 0 {
|
||||||
return nil, errors.Errorf("--health-interval cannot be negative")
|
return nil, errors.Errorf("--health-interval cannot be negative")
|
||||||
|
|
12
opts/opts.go
12
opts/opts.go
|
@ -55,7 +55,7 @@ func (opts *ListOpts) Set(value string) error {
|
||||||
}
|
}
|
||||||
value = v
|
value = v
|
||||||
}
|
}
|
||||||
(*opts.values) = append((*opts.values), value)
|
*opts.values = append(*opts.values, value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ func (opts *ListOpts) Set(value string) error {
|
||||||
func (opts *ListOpts) Delete(key string) {
|
func (opts *ListOpts) Delete(key string) {
|
||||||
for i, k := range *opts.values {
|
for i, k := range *opts.values {
|
||||||
if k == key {
|
if k == key {
|
||||||
(*opts.values) = append((*opts.values)[:i], (*opts.values)[i+1:]...)
|
*opts.values = append((*opts.values)[:i], (*opts.values)[i+1:]...)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ func (opts *ListOpts) GetMap() map[string]struct{} {
|
||||||
|
|
||||||
// GetAll returns the values of slice.
|
// GetAll returns the values of slice.
|
||||||
func (opts *ListOpts) GetAll() []string {
|
func (opts *ListOpts) GetAll() []string {
|
||||||
return (*opts.values)
|
return *opts.values
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAllOrEmpty returns the values of the slice
|
// 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.
|
// Len returns the amount of element in the slice.
|
||||||
func (opts *ListOpts) Len() int {
|
func (opts *ListOpts) Len() int {
|
||||||
return len((*opts.values))
|
return len(*opts.values)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns a string name for this Option type
|
// 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)
|
vals := strings.SplitN(value, "=", 2)
|
||||||
if len(vals) == 1 {
|
if len(vals) == 1 {
|
||||||
(opts.values)[vals[0]] = ""
|
opts.values[vals[0]] = ""
|
||||||
} else {
|
} else {
|
||||||
(opts.values)[vals[0]] = vals[1]
|
opts.values[vals[0]] = vals[1]
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (opt *ThrottledeviceOpt) Set(val string) error {
|
||||||
}
|
}
|
||||||
value = v
|
value = v
|
||||||
}
|
}
|
||||||
(opt.values) = append((opt.values), value)
|
opt.values = append(opt.values, value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,10 +93,7 @@ func (opt *ThrottledeviceOpt) String() string {
|
||||||
|
|
||||||
// GetList returns a slice of pointers to ThrottleDevices.
|
// GetList returns a slice of pointers to ThrottleDevices.
|
||||||
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
|
func (opt *ThrottledeviceOpt) GetList() []*blkiodev.ThrottleDevice {
|
||||||
var throttledevice []*blkiodev.ThrottleDevice
|
return append([]*blkiodev.ThrottleDevice{}, opt.values...)
|
||||||
throttledevice = append(throttledevice, opt.values...)
|
|
||||||
|
|
||||||
return throttledevice
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type returns the option type
|
// Type returns the option type
|
||||||
|
|
|
@ -59,7 +59,7 @@ func (opt *WeightdeviceOpt) Set(val string) error {
|
||||||
}
|
}
|
||||||
value = v
|
value = v
|
||||||
}
|
}
|
||||||
(opt.values) = append((opt.values), value)
|
opt.values = append(opt.values, value)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue