mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-05 04:29:19 +02:00
Adjust trim package name strategy
This commit is contained in:
parent
32e7cd80e8
commit
5a43fa750d
|
@ -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 New Issue