Skip to content

Commit

Permalink
add missing errors.Is conversions
Browse files Browse the repository at this point in the history
Signed-off-by: redwrasse <[email protected]>
  • Loading branch information
redwrasse committed Aug 30, 2024
1 parent de84109 commit ff8f4cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion client/pkg/fileutil/lock_flock.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package fileutil

import (
"errors"
"os"
"syscall"
)
Expand All @@ -28,7 +29,7 @@ func flockTryLockFile(path string, flag int, perm os.FileMode) (*LockedFile, err
}
if err = syscall.Flock(int(f.Fd()), syscall.LOCK_EX|syscall.LOCK_NB); err != nil {
f.Close()
if err == syscall.EWOULDBLOCK {
if errors.Is(err, syscall.EWOULDBLOCK) {
err = ErrLocked
}
return nil, err
Expand Down
5 changes: 3 additions & 2 deletions pkg/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package proxy

import (
"context"
"errors"
"fmt"
"io"
mrand "math/rand"
Expand Down Expand Up @@ -427,7 +428,7 @@ func (s *server) ioCopy(dst io.Writer, src io.Reader, ptype proxyType) {
for {
nr1, err := src.Read(buf)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
// connection already closed
Expand Down Expand Up @@ -545,7 +546,7 @@ func (s *server) ioCopy(dst io.Writer, src io.Reader, ptype proxyType) {
var nw int
nw, err = dst.Write(data)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
select {
Expand Down
3 changes: 2 additions & 1 deletion tests/integration/clientv3/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package clientv3test
import (
"bufio"
"context"
"errors"
"io"
"net"
"net/http"
Expand Down Expand Up @@ -165,7 +166,7 @@ func getHTTPBodyAsLines(t *testing.T, url string) []string {
for {
line, err := reader.ReadString('\n')
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
} else {
t.Fatalf("error reading: %v", err)
Expand Down

0 comments on commit ff8f4cc

Please sign in to comment.