Skip to content

Commit 6606d4d

Browse files
dsnetneild
andauthored
Use value.TypeString in PathStep.String (#306)
The value.TypeString function is what the rest of the package uses and is slightly cleaner than using reflect.Type.String. Updates #305 Co-authored-by: Damien Neil <[email protected]>
1 parent f36a68d commit 6606d4d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cmp/path.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (ps pathStep) String() string {
161161
if ps.typ == nil {
162162
return "<nil>"
163163
}
164-
s := ps.typ.String()
164+
s := value.TypeString(ps.typ, false)
165165
if s == "" || strings.ContainsAny(s, "{}\n") {
166166
return "root" // Type too simple or complex to print
167167
}
@@ -284,7 +284,7 @@ type typeAssertion struct {
284284

285285
func (ta TypeAssertion) Type() reflect.Type { return ta.typ }
286286
func (ta TypeAssertion) Values() (vx, vy reflect.Value) { return ta.vx, ta.vy }
287-
func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", ta.typ) }
287+
func (ta TypeAssertion) String() string { return fmt.Sprintf(".(%v)", value.TypeString(ta.typ, false)) }
288288

289289
// Transform is a transformation from the parent type to the current type.
290290
type Transform struct{ *transform }

0 commit comments

Comments
 (0)