mirror of https://github.com/docker/cli.git
Use an empty slice as default value for DNS, DNSSearch and DNSOptions
So we don't print those <no value> in the client and we don't fail executing inspect templates with API field names. Make sure those fields are initialized as empty slices when a container is loaded from disk and their values are nil. Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
parent
d02ac2a694
commit
8c734c8cde
10
opts/opts.go
10
opts/opts.go
|
@ -95,6 +95,16 @@ func (opts *ListOpts) GetAll() []string {
|
||||||
return (*opts.values)
|
return (*opts.values)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GetAllOrEmpty returns the values of the slice
|
||||||
|
// or an empty slice when there are no values.
|
||||||
|
func (opts *ListOpts) GetAllOrEmpty() []string {
|
||||||
|
v := *opts.values
|
||||||
|
if v == nil {
|
||||||
|
return make([]string, 0)
|
||||||
|
}
|
||||||
|
return v
|
||||||
|
}
|
||||||
|
|
||||||
// Get checks the existence of the specified key.
|
// Get checks the existence of the specified key.
|
||||||
func (opts *ListOpts) Get(key string) bool {
|
func (opts *ListOpts) Get(key string) bool {
|
||||||
for _, k := range *opts.values {
|
for _, k := range *opts.values {
|
||||||
|
|
Loading…
Reference in New Issue