@@ -76,19 +76,37 @@ type Link struct {
76
76
77
77
// formatError prints a single Links error
78
78
func (l * Link ) formatError (b []byte ) []byte {
79
+ var funcName string
80
+
79
81
b = append (b , "source=" ... )
80
82
idx := strings .LastIndexByte (l .Source .Frame .Function , '.' )
81
83
if idx == - 1 {
82
84
b = append (b , l .Source .File ()... )
83
85
} else {
84
- b = append (b , l .Source .Frame .Function [:idx ]... )
86
+ funcName = l .Source .Frame .Function [idx + 1 :]
87
+ remaining := l .Source .Frame .Function [:idx ]
88
+
89
+ idx = strings .LastIndexByte (remaining , '/' )
90
+ if idx > - 1 {
91
+ b = append (b , l .Source .Frame .Function [:idx + 1 ]... )
92
+ remaining = l .Source .Frame .Function [idx + 1 :]
93
+ }
94
+
95
+ idx = strings .IndexByte (remaining , '.' )
96
+ if idx == - 1 {
97
+ b = append (b , remaining ... )
98
+ } else {
99
+ b = append (b , remaining [:idx ]... )
100
+ }
85
101
b = append (b , '/' )
86
102
b = append (b , l .Source .File ()... )
87
103
}
88
104
b = append (b , ':' )
89
105
b = strconv .AppendInt (b , int64 (l .Source .Line ()), 10 )
90
- b = append (b , ':' )
91
- b = append (b , l .Source .Frame .Function [idx + 1 :]... )
106
+ if funcName != "" {
107
+ b = append (b , ':' )
108
+ b = append (b , funcName ... )
109
+ }
92
110
b = append (b , ' ' )
93
111
b = append (b , "error=" ... )
94
112
0 commit comments