From 1ff157804b6b21bff780a4b4645985396494b049 Mon Sep 17 00:00:00 2001 From: Avi Deitcher Date: Sun, 1 Sep 2024 22:23:02 +0300 Subject: [PATCH] lint fixes Signed-off-by: Avi Deitcher --- filesystem/squashfs/lru_test.go | 1 + partition/gpt/partition_internal_test.go | 5 +++++ partition/gpt/table_test.go | 6 ++++++ partition/mbr/partition_internal_test.go | 5 +++++ partition/mbr/table_test.go | 6 ++++++ 5 files changed, 23 insertions(+) diff --git a/filesystem/squashfs/lru_test.go b/filesystem/squashfs/lru_test.go index 1b62e021..e72d4907 100644 --- a/filesystem/squashfs/lru_test.go +++ b/filesystem/squashfs/lru_test.go @@ -58,6 +58,7 @@ func TestLRU(t *testing.T) { assertEmpty(true) }) + //nolint:revive // t is unused, but it should be kept here for the signature t.Run("Unlink", func(t *testing.T) { assertEmpty(true) block := &lruBlock{ diff --git a/partition/gpt/partition_internal_test.go b/partition/gpt/partition_internal_test.go index 72758585..b423bed3 100644 --- a/partition/gpt/partition_internal_test.go +++ b/partition/gpt/partition_internal_test.go @@ -347,6 +347,7 @@ func TestWriteContents(t *testing.T) { reader := bytes.NewReader(b) expected := "error writing to file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -379,6 +380,7 @@ func TestWriteContents(t *testing.T) { reader := bytes.NewReader(b) expected := "requested to write at least" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return len(b), nil }, @@ -412,6 +414,7 @@ func TestWriteContents(t *testing.T) { b2 := make([]byte, 0, size) reader := bytes.NewReader(b) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { b2 = append(b2, b...) return len(b), nil @@ -447,6 +450,7 @@ func TestReadContents(t *testing.T) { writer := bufio.NewWriter(&b) expected := "error reading from file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -477,6 +481,7 @@ func TestReadContents(t *testing.T) { b2 := make([]byte, size) _, _ = rand.Read(b2) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { copy(b, b2) return size, io.EOF diff --git a/partition/gpt/table_test.go b/partition/gpt/table_test.go index 2d10eb39..38592e54 100644 --- a/partition/gpt/table_test.go +++ b/partition/gpt/table_test.go @@ -106,6 +106,7 @@ func TestTableRead(t *testing.T) { t.Run("error reading file", func(t *testing.T) { expected := "error reading GPT from file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -125,6 +126,7 @@ func TestTableRead(t *testing.T) { size := 100 expected := fmt.Sprintf("read only %d bytes of GPT", size) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return size, nil }, @@ -165,6 +167,7 @@ func TestTableWrite(t *testing.T) { table := gpt.GetValidTable() expected := "error writing protective MBR to disk" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -181,6 +184,7 @@ func TestTableWrite(t *testing.T) { table := gpt.GetValidTable() var size int f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { size = len(b) - 1 return size, nil @@ -420,6 +424,7 @@ func TestReadPartitionContents(t *testing.T) { b2 := make([]byte, size) _, _ = rand.Read(b2) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { copy(b, b2) return size, io.EOF @@ -448,6 +453,7 @@ func TestWritePartitionContents(t *testing.T) { reader := bytes.NewReader(b) b2 := make([]byte, 0, size) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { b2 = append(b2, b...) return len(b), nil diff --git a/partition/mbr/partition_internal_test.go b/partition/mbr/partition_internal_test.go index 92c50810..6f6cde22 100644 --- a/partition/mbr/partition_internal_test.go +++ b/partition/mbr/partition_internal_test.go @@ -145,6 +145,7 @@ func TestReadContents(t *testing.T) { writer := bufio.NewWriter(&b) expected := "error reading from file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -179,6 +180,7 @@ func TestReadContents(t *testing.T) { b2 := make([]byte, size) _, _ = rand.Read(b2) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { copy(b, b2) return size, io.EOF @@ -248,6 +250,7 @@ func TestWriteContents(t *testing.T) { reader := bytes.NewReader(b) expected := "error writing to file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -283,6 +286,7 @@ func TestWriteContents(t *testing.T) { reader := bytes.NewReader(b) expected := "requested to write at least" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return len(b), nil }, @@ -323,6 +327,7 @@ func TestWriteContents(t *testing.T) { b2 := make([]byte, 0, size) reader := bytes.NewReader(b) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { b2 = append(b2, b...) return len(b), nil diff --git a/partition/mbr/table_test.go b/partition/mbr/table_test.go index 5336e7f9..285f7ead 100644 --- a/partition/mbr/table_test.go +++ b/partition/mbr/table_test.go @@ -99,6 +99,7 @@ func TestTableRead(t *testing.T) { t.Run("error reading file", func(t *testing.T) { expected := "error reading MBR from file" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -118,6 +119,7 @@ func TestTableRead(t *testing.T) { size := 100 expected := fmt.Sprintf("read only %d bytes of MBR", size) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { return size, nil }, @@ -157,6 +159,7 @@ func TestTableWrite(t *testing.T) { table := mbr.GetValidTable() expected := "error writing partition table to disk" f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { return 0, errors.New(expected) }, @@ -173,6 +176,7 @@ func TestTableWrite(t *testing.T) { table := mbr.GetValidTable() var size int f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { size = len(b) - 1 return size, nil @@ -370,6 +374,7 @@ func TestReadPartitionContents(t *testing.T) { b2 := make([]byte, size) _, _ = rand.Read(b2) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Reader signatire Reader: func(b []byte, offset int64) (int, error) { copy(b, b2) return size, io.EOF @@ -398,6 +403,7 @@ func TestWritePartitionContents(t *testing.T) { reader := bytes.NewReader(b) b2 := make([]byte, 0, size) f := &testhelper.FileImpl{ + //nolint:revive // b is unused, but we keep it here for the consistent io.Writer signatire Writer: func(b []byte, offset int64) (int, error) { b2 = append(b2, b...) return len(b), nil