mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-05 04:29:19 +02:00
Fix trim package name error (#36)
This commit is contained in:
parent
e3575277ba
commit
32e7cd80e8
|
@ -36,10 +36,12 @@ 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 {
|
||||||
return ""
|
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().
|
// Error implements error.Error().
|
||||||
|
|
|
@ -64,7 +64,7 @@ func executeRun(cmd *base.Command, args []string) {
|
||||||
printVersion()
|
printVersion()
|
||||||
server, err := startXray()
|
server, err := startXray()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
base.Fatalf("Filed to start: %s", err)
|
base.Fatalf("Failed to start: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if *test {
|
if *test {
|
||||||
|
@ -74,7 +74,7 @@ func executeRun(cmd *base.Command, args []string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := server.Start(); err != nil {
|
if err := server.Start(); err != nil {
|
||||||
base.Fatalf("Filed to start: %s", err)
|
base.Fatalf("Failed to start: %s", err)
|
||||||
}
|
}
|
||||||
defer server.Close()
|
defer server.Close()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue