mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-12-22 19:33:32 +02:00
Adjust trim package name strategy
This commit is contained in:
parent
32e7cd80e8
commit
5a43fa750d
1 changed files with 8 additions and 4 deletions
|
@ -36,12 +36,16 @@ func (err *Error) WithPathObj(obj interface{}) *Error {
|
|||
}
|
||||
|
||||
func (err *Error) pkgPath() string {
|
||||
if err.pathObj != nil {
|
||||
if p := reflect.TypeOf(err.pathObj).PkgPath(); !strings.HasPrefix(p, "main") {
|
||||
return p[trim:]
|
||||
if err.pathObj == nil {
|
||||
return ""
|
||||
}
|
||||
path := reflect.TypeOf(err.pathObj).PkgPath()
|
||||
for i := 0; i < len(path); i++ {
|
||||
if path[i] == '/' {
|
||||
return path[trim:]
|
||||
}
|
||||
}
|
||||
return ""
|
||||
return path
|
||||
}
|
||||
|
||||
// Error implements error.Error().
|
||||
|
|
Loading…
Reference in a new issue