Browse Source

refine package prefix cleanup

kslr 4 years ago
parent
commit
01380177b8
1 changed files with 2 additions and 3 deletions
  1. 2 3
      common/errors/errors.go

+ 2 - 3
common/errors/errors.go

@@ -38,9 +38,8 @@ func (err *Error) pkgPath() string {
 		return ""
 	}
 	path := reflect.TypeOf(err.pathObj).PkgPath()
-	if strings.HasPrefix(path, "github.com/v2fly/v2ray-core/v4/") {
-		return path[31:]
-	}
+	path = strings.TrimPrefix(path, "github.com/v2fly/v2ray-core/v4")
+	path = strings.TrimPrefix(path, "github.com/v2fly/v2ray-core/v4/")
 	return path
 }