mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #100362 from CaoDonghui123/fixissues6
Fix a panic in "e2e.test --help"
This commit is contained in:
commit
e471fa419e
@ -38,12 +38,16 @@ var _ goflag.Value = &StringSlice{}
|
||||
var _ pflag.Value = &StringSlice{}
|
||||
|
||||
func (s *StringSlice) String() string {
|
||||
if s == nil || s.value == nil {
|
||||
return ""
|
||||
}
|
||||
return strings.Join(*s.value, " ")
|
||||
}
|
||||
|
||||
func (s *StringSlice) Set(val string) error {
|
||||
if s.value == nil || !s.changed {
|
||||
*s.value = make([]string, 0)
|
||||
v := make([]string, 0)
|
||||
s.value = &v
|
||||
}
|
||||
*s.value = append(*s.value, val)
|
||||
s.changed = true
|
||||
|
@ -83,8 +83,8 @@ func TestStringSlice(t *testing.T) {
|
||||
} else if err != nil {
|
||||
t.Errorf("%d: expected nil error, got %v", i, err)
|
||||
}
|
||||
if !reflect.DeepEqual(s, test.expected) {
|
||||
t.Errorf("%d: expected %+v, got %+v", i, test.expected, s)
|
||||
if !reflect.DeepEqual(*v.value, test.expected) {
|
||||
t.Errorf("%d: expected %+v, got %+v", i, test.expected, *v.value)
|
||||
}
|
||||
if v.changed != test.changed {
|
||||
t.Errorf("%d: expected %t got %t", i, test.changed, v.changed)
|
||||
|
Loading…
Reference in New Issue
Block a user