fix comparison rule from errorlint

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
Matthieu MOREL
2025-06-08 11:52:34 +02:00
parent b65c31427c
commit 6d737371b8
95 changed files with 260 additions and 206 deletions

View File

@@ -22,7 +22,7 @@ func TestNotFound(t *testing.T) {
if !cerrdefs.IsNotFound(e) {
t.Fatalf("expected not found error, got: %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -43,7 +43,7 @@ func TestConflict(t *testing.T) {
if !cerrdefs.IsConflict(e) {
t.Fatalf("expected conflict error, got: %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -64,7 +64,7 @@ func TestForbidden(t *testing.T) {
if !cerrdefs.IsPermissionDenied(e) {
t.Fatalf("expected forbidden error, got: %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -85,7 +85,7 @@ func TestInvalidParameter(t *testing.T) {
if !cerrdefs.IsInvalidArgument(e) {
t.Fatalf("expected invalid argument error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -106,7 +106,7 @@ func TestNotImplemented(t *testing.T) {
if !cerrdefs.IsNotImplemented(e) {
t.Fatalf("expected not implemented error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -127,7 +127,7 @@ func TestNotModified(t *testing.T) {
if !cerrdefs.IsNotModified(e) {
t.Fatalf("expected not modified error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -148,7 +148,7 @@ func TestUnauthorized(t *testing.T) {
if !cerrdefs.IsUnauthorized(e) {
t.Fatalf("expected unauthorized error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -169,7 +169,7 @@ func TestUnknown(t *testing.T) {
if !cerrdefs.IsUnknown(e) {
t.Fatalf("expected unknown error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -190,7 +190,7 @@ func TestCancelled(t *testing.T) {
if !cerrdefs.IsCanceled(e) {
t.Fatalf("expected cancelled error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -211,7 +211,7 @@ func TestDeadline(t *testing.T) {
if !cerrdefs.IsDeadlineExceeded(e) {
t.Fatalf("expected deadline error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -232,7 +232,7 @@ func TestDataLoss(t *testing.T) {
if !cerrdefs.IsDataLoss(e) {
t.Fatalf("expected data loss error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -253,7 +253,7 @@ func TestUnavailable(t *testing.T) {
if !cerrdefs.IsUnavailable(e) {
t.Fatalf("expected unavaillable error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {
@@ -274,7 +274,7 @@ func TestSystem(t *testing.T) {
if !cerrdefs.IsInternal(e) {
t.Fatalf("expected system error, got %T", e)
}
if cause := e.(wrapped).Unwrap(); cause != errTest {
if cause := e.(wrapped).Unwrap(); cause != errTest { //nolint:errorlint // not using errors.Is, as this tests for the unwrapped error.
t.Fatalf("causual should be errTest, got: %v", cause)
}
if !errors.Is(e, errTest) {