Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions api/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ func (c *Client) GetAccessRequests(ctx context.Context, filter types.AccessReque
var reqs []types.AccessRequest
for {
req, err := stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}

Expand Down Expand Up @@ -3025,7 +3025,7 @@ func (c *Client) GetActiveSessionTrackers(ctx context.Context) ([]types.SessionT
for {
session, err := stream.Recv()
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}

Expand All @@ -3049,7 +3049,7 @@ func (c *Client) GetActiveSessionTrackersWithFilter(ctx context.Context, filter
for {
session, err := stream.Recv()
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}

Expand Down
3 changes: 2 additions & 1 deletion api/utils/sshutils/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package sshutils
import (
"crypto"
"crypto/subtle"
"errors"
"io"
"net"
"regexp"
Expand Down Expand Up @@ -67,7 +68,7 @@ func ParseKnownHosts(knownHosts [][]byte, matchHostnames ...string) ([]ssh.Publi
for _, line := range knownHosts {
for {
_, hosts, publicKey, _, bytes, err := ssh.ParseKnownHosts(line)
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
} else if err != nil {
return nil, trace.Wrap(err, "failed parsing known hosts: %v; raw line: %q", err, line)
Expand Down
3 changes: 2 additions & 1 deletion integrations/lib/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package lib

import (
"context"
"errors"
"io"

"github.com/gravitational/trace"
Expand All @@ -27,7 +28,7 @@ import (
// TODO: remove this when trail.FromGRPC will understand additional error codes
func FromGRPC(err error) error {
switch {
case err == io.EOF:
case errors.Is(err, io.EOF):
fallthrough
case status.Code(err) == codes.Canceled, err == context.Canceled:
fallthrough
Expand Down
3 changes: 2 additions & 1 deletion integrations/lib/tar/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package tar
import (
"archive/tar"
"compress/gzip"
"errors"
"io"
"os"
"path"
Expand Down Expand Up @@ -95,7 +96,7 @@ func Extract(reader io.Reader, options ExtractOptions) error {
}
for filesDone == nil || filesDone.Len() > 0 {
header, err := tarReader.Next()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion integrations/lib/tctl/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package tctl

import (
"encoding/json"
"errors"
"io"

"github.com/ghodss/yaml"
Expand Down Expand Up @@ -52,7 +53,7 @@ func readResourcesYAMLOrJSON(r io.Reader) ([]types.Resource, error) {
var res streamResource
err := decoder.Decode(&res)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
return nil, trace.Wrap(err)
Expand Down
5 changes: 3 additions & 2 deletions integrations/lib/testing/integration/authservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bufio"
"bytes"
"context"
"errors"
"io"
"os/exec"
"regexp"
Expand Down Expand Up @@ -146,7 +147,7 @@ func (auth *AuthService) Run(ctx context.Context) error {
stdout := bufio.NewReader(stdoutPipe)
for {
line, err := stdout.ReadString('\n')
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down Expand Up @@ -177,7 +178,7 @@ func (auth *AuthService) Run(ctx context.Context) error {
for {
n, err := stderr.Read(data)
auth.saveStderr(data[:n])
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions integrations/lib/testing/integration/proxyservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bufio"
"bytes"
"context"
"errors"
"fmt"
"io"
"os/exec"
Expand Down Expand Up @@ -151,7 +152,7 @@ func (proxy *ProxyService) Run(ctx context.Context) error {
stdout := bufio.NewReader(stdoutPipe)
for {
line, err := stdout.ReadString('\n')
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down Expand Up @@ -187,7 +188,7 @@ func (proxy *ProxyService) Run(ctx context.Context) error {
for {
n, err := stderr.Read(data)
proxy.saveStderr(data[:n])
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down
5 changes: 3 additions & 2 deletions integrations/lib/testing/integration/sshservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"bufio"
"bytes"
"context"
"errors"
"io"
"os/exec"
"regexp"
Expand Down Expand Up @@ -146,7 +147,7 @@ func (ssh *SSHService) Run(ctx context.Context) error {
stdout := bufio.NewReader(stdoutPipe)
for {
line, err := stdout.ReadString('\n')
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down Expand Up @@ -177,7 +178,7 @@ func (ssh *SSHService) Run(ctx context.Context) error {
for {
n, err := stderr.Read(data)
ssh.saveStderr(data[:n])
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}
if err := trace.Wrap(err); err != nil {
Expand Down
7 changes: 4 additions & 3 deletions lib/auth/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package auth
import (
"context"
"crypto/tls"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -165,7 +166,7 @@ func (g *GRPCServer) SendKeepAlives(stream proto.AuthService_SendKeepAlivesServe
return trace.Wrap(err)
}
keepAlive, err := stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
g.Debugf("Connection closed.")
return nil
}
Expand Down Expand Up @@ -223,7 +224,7 @@ func (g *GRPCServer) CreateAuditStream(stream proto.AuthService_CreateAuditStrea

for {
request, err := stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}
if err != nil {
Expand Down Expand Up @@ -2249,7 +2250,7 @@ func (g *GRPCServer) MaintainSessionPresence(stream proto.AuthService_MaintainSe

for {
req, err := stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}

Expand Down
3 changes: 2 additions & 1 deletion lib/client/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package client

import (
"context"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -643,7 +644,7 @@ func handleNonPeerControls(mode types.SessionParticipantMode, term *terminal.Ter
for {
buf := make([]byte, 1)
_, err := term.Stdin().Read(buf)
if err == io.EOF {
if errors.Is(err, io.EOF) {
return
}

Expand Down
3 changes: 2 additions & 1 deletion lib/config/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package config

import (
"crypto/x509"
"errors"
"io"
stdlog "log"
"net"
Expand Down Expand Up @@ -218,7 +219,7 @@ func ReadResources(filePath string) ([]types.Resource, error) {
var raw services.UnknownResource
err := decoder.Decode(&raw)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
return nil, trace.Wrap(err)
Expand Down
3 changes: 2 additions & 1 deletion lib/events/auditlog.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"compress/gzip"
"context"
"encoding/json"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -643,7 +644,7 @@ func (l *AuditLog) GetSessionChunk(namespace string, sid session.ID, offsetBytes
for {
out, err := l.getSessionChunk(namespace, sid, offsetBytes, maxBytes)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return data, nil
}
return nil, trace.Wrap(err)
Expand Down
2 changes: 1 addition & 1 deletion lib/events/filesessions/fileasync.go
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ func (u *Uploader) upload(ctx context.Context, up *upload) error {
for {
event, err := up.reader.Read(ctx)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
return sessionError{err: trace.Wrap(err)}
Expand Down
7 changes: 4 additions & 3 deletions lib/events/playback.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"compress/gzip"
"context"
"encoding/binary"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -96,7 +97,7 @@ func Export(ctx context.Context, rs io.ReadSeeker, w io.Writer, exportFormat str
for {
event, err := protoReader.Read(ctx)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}
return trace.Wrap(err)
Expand Down Expand Up @@ -159,7 +160,7 @@ func (w *SSHPlaybackWriter) SessionEvents() ([]EventFields, error) {
var f EventFields
err := utils.FastUnmarshal(scanner.Bytes(), &f)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return sessionEvents, nil
}
return nil, trace.Wrap(err)
Expand Down Expand Up @@ -250,7 +251,7 @@ func (w *SSHPlaybackWriter) Write(ctx context.Context) error {
for {
event, err := w.reader.Read(ctx)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}
return trace.Wrap(err)
Expand Down
4 changes: 2 additions & 2 deletions lib/events/stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,7 @@ func (r *ProtoReader) Read(ctx context.Context) (apievents.AuditEvent, error) {
_, err := io.ReadFull(r.reader, r.sizeBytes[:Int64Size])
if err != nil {
// reached the end of the stream
if err == io.EOF {
if errors.Is(err, io.EOF) {
r.state = protoReaderStateEOF
return nil, err
}
Expand Down Expand Up @@ -1116,7 +1116,7 @@ func (r *ProtoReader) ReadAll(ctx context.Context) ([]apievents.AuditEvent, erro
for {
event, err := r.Read(ctx)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return events, nil
}
return nil, trace.Wrap(err)
Expand Down
3 changes: 2 additions & 1 deletion lib/kube/proxy/testing/kube_server/kube_mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"context"
"crypto/tls"
"encoding/json"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -215,7 +216,7 @@ func (s *KubeMockServer) exec(w http.ResponseWriter, req *http.Request, p httpro
for {
buffer = buffer[:cap(buffer)]
n, err := proxy.stdinStream.Read(buffer)
if err == io.EOF && n == 0 {
if errors.Is(err, io.EOF) && n == 0 {
break
} else if err != nil && n == 0 {
s.log.WithError(err).Errorf("unable to receive from stdin")
Expand Down
3 changes: 2 additions & 1 deletion lib/proxy/peer/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package peer

import (
"context"
"errors"
"io"
"net"
"sync"
Expand Down Expand Up @@ -69,7 +70,7 @@ func (c *streamConn) Read(b []byte) (n int, err error) {

if len(c.rBytes) == 0 {
frame, err := c.stream.Recv()
if err == io.EOF {
if errors.Is(err, io.EOF) {
return 0, io.EOF
}
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion lib/srv/ctx.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package srv
import (
"context"
"encoding/json"
"errors"
"fmt"
"io"
"net"
Expand Down Expand Up @@ -873,7 +874,7 @@ func (c *ServerContext) x11Ready() (bool, error) {
// Wait for child process to send signal (1 byte)
// or EOF if signal was already received.
_, err := io.ReadFull(c.x11rdyr, make([]byte, 1))
if err == io.EOF {
if errors.Is(err, io.EOF) {
return true, nil
} else if err != nil {
return false, trace.Wrap(err)
Expand Down
3 changes: 2 additions & 1 deletion lib/srv/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package srv
import (
"bufio"
"context"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -270,7 +271,7 @@ func waitForContinue(contfd *os.File) error {
// won't be closed until the parent has placed it in a cgroup.
buf := make([]byte, 1)
_, err := contfd.Read(buf)
if err == io.EOF {
if errors.Is(err, io.EOF) {
err = nil
}
waitCh <- err
Expand Down
2 changes: 1 addition & 1 deletion lib/srv/reexec.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ func waitForShell(termiantefd *os.File, cmd *exec.Cmd) error {
// Wait for the terminate file descriptor to be closed. The FD will be closed when Teleport
// parent process wants to terminate the remote command and all childs.
_, err := termiantefd.Read(buf)
if err == io.EOF {
if errors.Is(err, io.EOF) {
// Kill the shell process
err = trace.Errorf("shell process has been killed: %w", cmd.Process.Kill())
} else {
Expand Down
Loading