From aad5da53df99a3c8934e001ce03eaa8c09f15e7a Mon Sep 17 00:00:00 2001 From: Brian Shih Date: Sun, 21 Apr 2024 11:52:37 -0400 Subject: [PATCH] lint --- decoder.go | 6 +++--- decoder_array_test.go | 2 +- decoder_test.go | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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) {