From 18f90b4ebffdad82877693a4e5bb6d2c987f925a Mon Sep 17 00:00:00 2001 From: phith0n Date: Mon, 5 Aug 2024 15:38:48 +0800 Subject: [PATCH] fixed lint issues --- commons/stream.go | 4 ++-- commons/stream_test.go | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/commons/stream.go b/commons/stream.go index 82581fd..90caaf8 100644 --- a/commons/stream.go +++ b/commons/stream.go @@ -8,8 +8,8 @@ import ( type Stream struct { reader io.Reader - buf []byte - index int + buf []byte + index int } func (s *Stream) ReadN(n int) ([]byte, error) { diff --git a/commons/stream_test.go b/commons/stream_test.go index 5d2c0b9..36812fa 100644 --- a/commons/stream_test.go +++ b/commons/stream_test.go @@ -75,17 +75,17 @@ func TestStreamReader(t *testing.T) { data, err = s.ReadN(3) require.NoError(t, err) require.Equal(t, []byte("eee"), data) - data, err = s.PeekN(4) + _, err = s.PeekN(4) require.Error(t, err) data, err = s.PeekN(1) require.NoError(t, err) require.Equal(t, []byte("e"), data) - data, err = s.ReadN(2) + _, err = s.ReadN(2) require.Error(t, err) data, err = s.ReadN(1) require.NoError(t, err) require.Equal(t, []byte("e"), data) - data, err = s.ReadN(1) + _, err = s.ReadN(1) require.Error(t, err) } @@ -99,11 +99,11 @@ func TestEmptyStream(t *testing.T) { require.Error(t, err) require.Nil(t, data) - data, err = s.PeekN(1) + _, err = s.PeekN(1) require.Error(t, err) s = NewStreamFromReader(bytes.NewReader(nil)) - data, err = s.ReadN(1) + _, err = s.ReadN(1) require.Error(t, err) } @@ -113,7 +113,7 @@ func TestStreamBuf(t *testing.T) { var err error s = NewStreamFromReader(bytes.NewReader([]byte("abbcccddddeeeee"))) - data, err = s.PeekN(20) + _, err = s.PeekN(20) require.Error(t, err) data, err = s.PeekN(3) @@ -128,4 +128,3 @@ func TestStreamBuf(t *testing.T) { require.NoError(t, err) require.Equal(t, []byte("cddddeeeee"), data) } -