Skip to content

Commit

Permalink
不同平台的标识移到path
Browse files Browse the repository at this point in the history
  • Loading branch information
steden committed Oct 22, 2023
1 parent 4c8d139 commit 9481268
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build_darwin.go → path/build_darwin.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build darwin

package fs
package path

const Newline = "\n"
const PathSymbol = "/"
2 changes: 1 addition & 1 deletion build_linux.go → path/build_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build linux

package fs
package path

const Newline = "\n"
const PathSymbol = "/"
2 changes: 1 addition & 1 deletion build_windows.go → path/build_windows.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//go:build windows

package fs
package path

const Newline = "\r\n"
const PathSymbol = "\\"
6 changes: 3 additions & 3 deletions trace/baseTraceDetail.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package trace

import (
"github.com/farseer-go/collections"
"github.com/farseer-go/fs"
"github.com/farseer-go/fs/asyncLocal"
"github.com/farseer-go/fs/flog"
"github.com/farseer-go/fs/path"
"github.com/farseer-go/linkTrace/eumCallType"
"runtime"
"strings"
Expand Down Expand Up @@ -77,12 +77,12 @@ func getCallerInfo() (string, string, int) {
frame, more := frames.Next()
if !strings.HasSuffix(frame.File, "_test.go") && (!flog.IsSysCom(frame.File) || strings.HasSuffix(frame.File, "healthCheck.go")) { // !strings.HasPrefix(file, gormSourceDir) ||
// 移除绝对路径
prefixFunc := frame.Function[0 : strings.Index(frame.Function, fs.PathSymbol)+1]
prefixFunc := frame.Function[0 : strings.Index(frame.Function, path.PathSymbol)+len(path.PathSymbol)]
packageIndex := strings.Index(frame.File, prefixFunc)
file := frame.File[packageIndex:]

// 只要最后的方法名
funcName := frame.Function[strings.LastIndex(frame.Function, fs.PathSymbol)+1:] + "()"
funcName := frame.Function[strings.LastIndex(frame.Function, path.PathSymbol)+len(path.PathSymbol):] + "()"
return file, funcName, frame.Line
}
if !more {
Expand Down

0 comments on commit 9481268

Please sign in to comment.