follow pointers
diff --git a/formatter.go b/formatter.go
index e0d96f6..ea329d1 100644
--- a/formatter.go
+++ b/formatter.go
@@ -94,6 +94,14 @@
fmt.Fprintf(w, "%#v", s[l:h])
}
return
+ case *reflect.PtrValue:
+ e := v.Elem()
+ if e == nil {
+ fmt.Fprintf(w, "%#v", fo.x)
+ } else {
+ writeByte(w, '&')
+ fmt.Fprintf(w, "%# v", formatter{d: fo.d, x: e.Interface()})
+ }
case *reflect.SliceValue:
s := fmt.Sprintf("%#v", fo.x)
if len(s) < limit {
diff --git a/formatter_test.go b/formatter_test.go
index 7a2bdcf..f818b8a 100644
--- a/formatter_test.go
+++ b/formatter_test.go
@@ -45,6 +45,17 @@
}`,
},
{
+ &LongStructTypeName{
+ longFieldName: &LongStructTypeName{
+ },
+ otherLongFieldName: (*LongStructTypeName)(nil),
+ },
+ `&pretty.LongStructTypeName{
+ longFieldName: &pretty.LongStructTypeName{},
+ otherLongFieldName: (*pretty.LongStructTypeName)(nil),
+}`,
+ },
+ {
[]LongStructTypeName{
{nil, nil},
{3, 3},