aboutsummaryrefslogtreecommitdiff
path: root/cmp/report_reflect.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmp/report_reflect.go')
-rw-r--r--cmp/report_reflect.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/cmp/report_reflect.go b/cmp/report_reflect.go
index 33f0357..76c04fd 100644
--- a/cmp/report_reflect.go
+++ b/cmp/report_reflect.go
@@ -207,9 +207,10 @@ func (opts formatOptions) FormatValue(v reflect.Value, parentKind reflect.Kind,
// Check whether this is a []byte of text data.
if t.Elem() == reflect.TypeOf(byte(0)) {
b := v.Bytes()
- isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) && unicode.IsSpace(r) }
+ isPrintSpace := func(r rune) bool { return unicode.IsPrint(r) || unicode.IsSpace(r) }
if len(b) > 0 && utf8.Valid(b) && len(bytes.TrimFunc(b, isPrintSpace)) == 0 {
out = opts.formatString("", string(b))
+ skipType = true
return opts.WithTypeMode(emitType).FormatType(t, out)
}
}