aboutsummaryrefslogtreecommitdiff
path: root/cmp/internal/value/name.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmp/internal/value/name.go')
-rw-r--r--cmp/internal/value/name.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/cmp/internal/value/name.go b/cmp/internal/value/name.go
index b6c12ce..7b498bb 100644
--- a/cmp/internal/value/name.go
+++ b/cmp/internal/value/name.go
@@ -9,6 +9,8 @@ import (
"strconv"
)
+var anyType = reflect.TypeOf((*interface{})(nil)).Elem()
+
// TypeString is nearly identical to reflect.Type.String,
// but has an additional option to specify that full type names be used.
func TypeString(t reflect.Type, qualified bool) string {
@@ -20,6 +22,11 @@ func appendTypeName(b []byte, t reflect.Type, qualified, elideFunc bool) []byte
// of the same name and within the same package,
// but declared within the namespace of different functions.
+ // Use the "any" alias instead of "interface{}" for better readability.
+ if t == anyType {
+ return append(b, "any"...)
+ }
+
// Named type.
if t.Name() != "" {
if qualified && t.PkgPath() != "" {