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 @@ -824,7 +824,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 @@ -2802,7 +2802,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 @@ -2826,7 +2826,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 @@ -73,7 +74,7 @@ func ParseKnownHosts(knownHosts [][]byte) ([]ssh.PublicKey, error) {
for _, line := range knownHosts {
for {
_, _, 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
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 @@ -160,7 +161,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 @@ -218,7 +219,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 @@ -2070,7 +2071,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 @@ -23,6 +23,7 @@ package config
import (
"bufio"
"crypto/x509"
"errors"
"io"
stdlog "log"
"net"
Expand Down Expand Up @@ -192,7 +193,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 @@ -613,7 +614,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 @@ -1011,7 +1011,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 @@ -1112,7 +1112,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 @@ -213,7 +214,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
3 changes: 2 additions & 1 deletion lib/sshutils/scp/scp.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package scp

import (
"bufio"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -415,7 +416,7 @@ func (cmd *command) serveSink(ch io.ReadWriter) error {
for {
n, err := ch.Read(b[:])
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}
return trace.Wrap(err)
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/archive_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package utils
import (
"archive/tar"
"compress/gzip"
"errors"
"io"
"io/fs"
"testing"
Expand Down Expand Up @@ -102,7 +103,7 @@ func TestCompressAsTarGzArchive(t *testing.T) {
tarReader := tar.NewReader(gzipReader)
for {
header, err := tarReader.Next()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
require.NoError(t, err)
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/jsontools.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package utils
import (
"bytes"
"encoding/json"
"errors"
"io"
"reflect"
"unicode"
Expand Down Expand Up @@ -213,7 +214,7 @@ func ReadYAML(reader io.Reader) (interface{}, error) {
var val interface{}
err := decoder.Decode(&val)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
if len(values) == 0 {
return nil, trace.BadParameter("no resources found, empty input?")
}
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/unpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package utils

import (
"archive/tar"
"errors"
"io"
"os"
"path/filepath"
Expand All @@ -38,7 +39,7 @@ func Extract(r io.Reader, dir string) error {

for {
header, err := tarball.Next()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
} else if err != nil {
return trace.Wrap(err)
Expand Down
2 changes: 1 addition & 1 deletion lib/web/apiserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2978,7 +2978,7 @@ func TestSignMTLS(t *testing.T) {
tarContentFileNames := []string{}
for {
header, err := tarReader.Next()
if err == io.EOF {
if errors.Is(err, io.EOF) {
break
}
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion lib/web/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ func (t *TerminalStream) Read(out []byte) (n int, err error) {
if err != nil {
// if the connection has closed, we must return io.EOF in order to abort
// the websocket copy loop
if err == io.EOF || errors.Is(err, net.ErrClosed) ||
if errors.Is(err, io.EOF) || errors.Is(err, net.ErrClosed) ||
websocket.IsCloseError(err, websocket.CloseAbnormalClosure, websocket.CloseGoingAway, websocket.CloseNormalClosure) {
return 0, io.EOF
}
Expand Down
3 changes: 2 additions & 1 deletion tool/tctl/common/resource_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package common

import (
"context"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -266,7 +267,7 @@ func (rc *ResourceCommand) Create(ctx context.Context, client auth.ClientI) (err
var raw services.UnknownResource
err := decoder.Decode(&raw)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
if count == 0 {
return trace.BadParameter("no resources found, empty input?")
}
Expand Down
3 changes: 2 additions & 1 deletion tool/tctl/sso/tester/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package tester

import (
"context"
"errors"
"fmt"
"io"
"os"
Expand Down Expand Up @@ -110,7 +111,7 @@ func (cmd *SSOTestCommand) ssoTestCommand(ctx context.Context, c auth.ClientI) e
var raw services.UnknownResource
err := decoder.Decode(&raw)
if err != nil {
if err == io.EOF {
if errors.Is(err, io.EOF) {
return nil
}
return trace.Wrap(err, "Unable to load resource. Make sure the file is in correct format.")
Expand Down