mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
Fix trim package name error (#36)
This commit is contained in:
parent
e3575277ba
commit
32e7cd80e8
2 changed files with 7 additions and 5 deletions
|
@ -36,10 +36,12 @@ func (err *Error) WithPathObj(obj interface{}) *Error {
|
|||
}
|
||||
|
||||
func (err *Error) pkgPath() string {
|
||||
if err.pathObj == nil {
|
||||
return ""
|
||||
if err.pathObj != nil {
|
||||
if p := reflect.TypeOf(err.pathObj).PkgPath(); !strings.HasPrefix(p, "main") {
|
||||
return p[trim:]
|
||||
}
|
||||
}
|
||||
return reflect.TypeOf(err.pathObj).PkgPath()[trim:]
|
||||
return ""
|
||||
}
|
||||
|
||||
// Error implements error.Error().
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue