Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarthik Nayak <knayak@gitlab.com>2023-11-29 19:12:19 +0300
committerKarthik Nayak <knayak@gitlab.com>2023-11-30 18:15:59 +0300
commitde8220dfa186ef1d864050db8473f5bc629113ef (patch)
treededa3193e6292dd4fb09142976ed214ef092d473 /internal/praefect
parentd7a8950852c72234ae41bcd2e88848af2baa643a (diff)
errors: Use `errors.Is()` for `io.EOF` errors
Replace all io.EOF errors comparisons with errors.Is(). This ensures that these errors work correctly with wrapped errors. This also makes way for adding an error linter in the upcoming commits. The changes in this commit were done automagically using project wide replace methods provided by the text editor.
Diffstat (limited to 'internal/praefect')
-rw-r--r--internal/praefect/middleware/errorhandler.go3
-rw-r--r--internal/praefect/server_test.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/internal/praefect/middleware/errorhandler.go b/internal/praefect/middleware/errorhandler.go
index f475507f4..8dbba24de 100644
--- a/internal/praefect/middleware/errorhandler.go
+++ b/internal/praefect/middleware/errorhandler.go
@@ -2,6 +2,7 @@ package middleware
import (
"context"
+ "errors"
"fmt"
"io"
@@ -60,7 +61,7 @@ func (c *catchErrorStreamer) SendMsg(m interface{}) error {
// RecvMsg proxies the send but records any errors
func (c *catchErrorStreamer) RecvMsg(m interface{}) error {
err := c.ClientStream.RecvMsg(m)
- if err != nil && err != io.EOF {
+ if err != nil && !errors.Is(err, io.EOF) {
switch c.operation {
case protoregistry.OpAccessor:
c.errors.IncrReadErr(c.nodeStorage)
diff --git a/internal/praefect/server_test.go b/internal/praefect/server_test.go
index 94cc2e35a..ded415211 100644
--- a/internal/praefect/server_test.go
+++ b/internal/praefect/server_test.go
@@ -777,7 +777,7 @@ func TestProxyWrites(t *testing.T) {
for {
resp, err := stream.Recv()
if err != nil {
- if err == io.EOF {
+ if errors.Is(err, io.EOF) {
break
}
require.FailNowf(t, "unexpected non io.EOF error: %v", err.Error())