testutil: Print <invalid> instead of crashing on invalid value
This commit is contained in:
parent
92040a1bc4
commit
81391ef101
@ -119,6 +119,10 @@ type describer struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *describer) describe(value reflect.Value) {
|
func (this *describer) describe(value reflect.Value) {
|
||||||
|
if !value.IsValid() {
|
||||||
|
this.printf("<invalid>")
|
||||||
|
return
|
||||||
|
}
|
||||||
value = reflect.ValueOf(value.Interface())
|
value = reflect.ValueOf(value.Interface())
|
||||||
switch value.Kind() {
|
switch value.Kind() {
|
||||||
case reflect.Array, reflect.Slice:
|
case reflect.Array, reflect.Slice:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user