mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-04-29 16:58:34 +00:00
v1.1.0
This commit is contained in:
parent
ed8d6d743c
commit
16544c18ab
627 changed files with 3247 additions and 2635 deletions
|
@ -6,7 +6,7 @@ import (
|
|||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/xtls/xray-core/v1/common"
|
||||
"github.com/xtls/xray-core/common"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -1,15 +1,17 @@
|
|||
// Package errors is a drop-in replacement for Golang lib 'errors'.
|
||||
package errors // import "github.com/xtls/xray-core/v1/common/errors"
|
||||
package errors // import "github.com/xtls/xray-core/common/errors"
|
||||
|
||||
import (
|
||||
"os"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/v1/common/log"
|
||||
"github.com/xtls/xray-core/v1/common/serial"
|
||||
"github.com/xtls/xray-core/common/log"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
)
|
||||
|
||||
const trim = len("github.com/xtls/xray-core/")
|
||||
|
||||
type hasInnerError interface {
|
||||
// Inner returns the underlying error of this one.
|
||||
Inner() error
|
||||
|
@ -37,7 +39,7 @@ func (err *Error) pkgPath() string {
|
|||
if err.pathObj == nil {
|
||||
return ""
|
||||
}
|
||||
return reflect.TypeOf(err.pathObj).PkgPath()
|
||||
return reflect.TypeOf(err.pathObj).PkgPath()[trim:]
|
||||
}
|
||||
|
||||
// Error implements error.Error().
|
||||
|
|
|
@ -7,8 +7,8 @@ import (
|
|||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
|
||||
. "github.com/xtls/xray-core/v1/common/errors"
|
||||
"github.com/xtls/xray-core/v1/common/log"
|
||||
. "github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/log"
|
||||
)
|
||||
|
||||
func TestError(t *testing.T) {
|
||||
|
@ -46,11 +46,11 @@ func TestErrorMessage(t *testing.T) {
|
|||
}{
|
||||
{
|
||||
err: New("a").Base(New("b")).WithPathObj(e{}),
|
||||
msg: "github.com/xtls/xray-core/v1/common/errors_test: a > b",
|
||||
msg: "common/errors_test: a > b",
|
||||
},
|
||||
{
|
||||
err: New("a").Base(New("b").WithPathObj(e{})),
|
||||
msg: "a > github.com/xtls/xray-core/v1/common/errors_test: b",
|
||||
msg: "a > common/errors_test: b",
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue