diff --git a/server/errors.go b/server/errors.go index 93213785..d10474bd 100644 --- a/server/errors.go +++ b/server/errors.go @@ -261,7 +261,7 @@ func errorsUnwrap(err error) error { // implements: go 1.13 errors.Is(err, target error) bool // TODO replace with native code once we no longer support go1.12 -func IsErr(err, target error) bool { +func ErrorIs(err, target error) bool { // this is an outright copy of go 1.13 errors.Is(err, target error) bool // removed isComparable if err == nil || target == nil { diff --git a/server/errors_test.go b/server/errors_test.go index 76997357..2b43c4e8 100644 --- a/server/errors_test.go +++ b/server/errors_test.go @@ -28,7 +28,7 @@ func TestErrCtx(t *testing.T) { if e == ErrWrongGateway { t.Fatalf("%v and %v can't be compared this way", e, ErrWrongGateway) } - if !IsErr(e, ErrWrongGateway) { + if !ErrorIs(e, ErrWrongGateway) { t.Fatalf("%s and %s ", e, ErrWrongGateway) } if UnpackIfErrorCtx(ErrWrongGateway) != ErrWrongGateway.Error() { @@ -55,7 +55,7 @@ func TestErrCtxWrapped(t *testing.T) { if e == ErrWrongGateway { t.Fatalf("%v and %v can't be compared this way", e, ErrWrongGateway) } - if !IsErr(e, ErrWrongGateway) { + if !ErrorIs(e, ErrWrongGateway) { t.Fatalf("%s and %s ", e, ErrWrongGateway) } if UnpackIfErrorCtx(ErrWrongGateway) != ErrWrongGateway.Error() { diff --git a/server/parser_test.go b/server/parser_test.go index fbaa81c9..7f2aece9 100644 --- a/server/parser_test.go +++ b/server/parser_test.go @@ -582,7 +582,7 @@ func TestMaxControlLine(t *testing.T) { pub := []byte("PUB foo.bar 11\r") err := c.parse(pub) - if !IsErr(err, ErrMaxControlLine) { + if !ErrorIs(err, ErrMaxControlLine) { t.Fatalf("Expected an error parsing longer than expected control line") } }