Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ioutil: remaining errors.Is conversions #18619

Merged
merged 2 commits into from
Sep 22, 2024
Merged
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
5 changes: 3 additions & 2 deletions pkg/ioutil/readcloser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package ioutil

import (
"bytes"
"errors"
"io"
"testing"
)
Expand All @@ -28,7 +29,7 @@ func (rc *readerNilCloser) Close() error { return nil }
func TestExactReadCloserExpectEOF(t *testing.T) {
buf := bytes.NewBuffer(make([]byte, 10))
rc := NewExactReadCloser(&readerNilCloser{buf}, 1)
if _, err := rc.Read(make([]byte, 10)); err != ErrExpectEOF {
if _, err := rc.Read(make([]byte, 10)); !errors.Is(err, ErrExpectEOF) {
t.Fatalf("expected %v, got %v", ErrExpectEOF, err)
}
}
Expand All @@ -40,7 +41,7 @@ func TestExactReadCloserShort(t *testing.T) {
if _, err := rc.Read(make([]byte, 10)); err != nil {
t.Fatalf("Read expected nil err, got %v", err)
}
if err := rc.Close(); err != ErrShortRead {
if err := rc.Close(); !errors.Is(err, ErrShortRead) {
t.Fatalf("Close expected %v, got %v", ErrShortRead, err)
}
}
Loading