mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 12:49:20 +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 {
|
func (err *Error) pkgPath() string {
|
||||||
if err.pathObj != nil {
|
if err.pathObj == nil {
|
||||||
if p := reflect.TypeOf(err.pathObj).PkgPath(); !strings.HasPrefix(p, "main") {
|
return ""
|
||||||
return p[trim:]
|
}
|
||||||
|
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().
|
// Error implements error.Error().
|
||||||
|
|
Loading…
Reference in New Issue