mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
MapString* should return empty string for String() when null
This commit is contained in:
parent
b52ebfa28e
commit
ccec4c507f
@ -39,6 +39,9 @@ func NewMapStringBool(m *map[string]bool) *MapStringBool {
|
||||
|
||||
// String implements github.com/spf13/pflag.Value
|
||||
func (m *MapStringBool) String() string {
|
||||
if m == nil || m.Map == nil {
|
||||
return ""
|
||||
}
|
||||
pairs := []string{}
|
||||
for k, v := range *m.Map {
|
||||
pairs = append(pairs, fmt.Sprintf("%s=%t", k, v))
|
||||
|
@ -50,6 +50,9 @@ func NewMapStringStringNoSplit(m *map[string]string) *MapStringString {
|
||||
|
||||
// String implements github.com/spf13/pflag.Value
|
||||
func (m *MapStringString) String() string {
|
||||
if m == nil || m.Map == nil {
|
||||
return ""
|
||||
}
|
||||
pairs := []string{}
|
||||
for k, v := range *m.Map {
|
||||
pairs = append(pairs, fmt.Sprintf("%s=%s", k, v))
|
||||
|
Loading…
Reference in New Issue
Block a user