mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 14:46:04 +03:00
Adjust trim package name strategy
This commit is contained in:
parent
32e7cd80e8
commit
5a43fa750d
@ -36,13 +36,17 @@ 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 path
|
||||
}
|
||||
|
||||
// Error implements error.Error().
|
||||
func (err *Error) Error() string {
|
||||
|
Loading…
Reference in New Issue
Block a user