diff --git a/decoder.go b/decoder.go index ac89b07..147023d 100644 --- a/decoder.go +++ b/decoder.go @@ -49,7 +49,7 @@ func Unmarshal(schema Schema, data []byte, v any) error { return DefaultConfig.Unmarshal(schema, data, v) } -// Whether the decoder's reader has reached EOF. -func (d *Decoder) IsEof() bool { - return d.r.Error == io.EOF +// IsEOF returns Whether the decoder's reader has reached EOF. +func (d *Decoder) IsEOF() bool { + return errors.Is(d.r.Error, io.EOF) } diff --git a/decoder_array_test.go b/decoder_array_test.go index dfb1b7c..dd9fc68 100644 --- a/decoder_array_test.go +++ b/decoder_array_test.go @@ -117,6 +117,6 @@ func TestDecoder_ArrayEof(t *testing.T) { var got []bool err = dec.Decode(&got) - assert.True(t, dec.IsEof()) + assert.True(t, dec.IsEOF()) assert.NoError(t, err) } diff --git a/decoder_test.go b/decoder_test.go index d4253ce..c090fb2 100644 --- a/decoder_test.go +++ b/decoder_test.go @@ -79,7 +79,7 @@ func TestDecoder_DecodeEOFDoesntReturnError(t *testing.T) { err := dec.Decode(&i) assert.NoError(t, err) - assert.True(t, dec.IsEof()) + assert.True(t, dec.IsEOF()) } func TestUnmarshal(t *testing.T) {