Skip to content

Commit 013a60c

Browse files
committed
fix coverage
1 parent a056f81 commit 013a60c

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

internal/stack/record.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package stack
22

33
import (
44
"fmt"
5+
"path"
56
"runtime"
67
"strings"
78

@@ -108,11 +109,7 @@ func (c call) Record(opts ...recordOption) string {
108109

109110
func extractName(function uintptr, file string) (name, fileName string) {
110111
name = runtime.FuncForPC(function).Name()
111-
if i := strings.LastIndex(file, "/"); i > -1 {
112-
fileName = file[i+1:]
113-
} else {
114-
fileName = file
115-
}
112+
_, fileName = path.Split(file)
116113
name = strings.ReplaceAll(name, "[...]", "")
117114

118115
return name, fileName

0 commit comments

Comments
 (0)