mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Merge pull request #2814 from satnam6502/list
Do not consider an empty string to be an error in list.go
This commit is contained in:
commit
5523e0344a
@ -29,9 +29,6 @@ func (sl *StringList) String() string {
|
||||
|
||||
func (sl *StringList) Set(value string) error {
|
||||
for _, s := range strings.Split(value, ",") {
|
||||
if len(s) == 0 {
|
||||
return fmt.Errorf("value should not be an empty string")
|
||||
}
|
||||
*sl = append(*sl, s)
|
||||
}
|
||||
return nil
|
||||
|
@ -30,13 +30,3 @@ func TestStringListSet(t *testing.T) {
|
||||
t.Errorf("expected: %v, got: %v:", expected, sl)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStringListSetErr(t *testing.T) {
|
||||
var sl StringList
|
||||
if err := sl.Set(""); err == nil {
|
||||
t.Errorf("expected error for empty string")
|
||||
}
|
||||
if err := sl.Set(","); err == nil {
|
||||
t.Errorf("expected error for list of empty strings")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user