From f18b8d707e33f0c15b80dbf7846938082dd9e40b Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Thu, 12 Feb 2026 18:05:16 +0100 Subject: [PATCH] fix "prealloc" linting Signed-off-by: Sebastiaan van Stijn --- notifications/listener_test.go | 5 ++--- registry/storage/driver/s3-aws/s3_test.go | 2 +- registry/storage/linkedblobstore_test.go | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/notifications/listener_test.go b/notifications/listener_test.go index 590b97566..ddb788b26 100644 --- a/notifications/listener_test.go +++ b/notifications/listener_test.go @@ -127,9 +127,6 @@ func checkTestRepository(t *testing.T, repository distribution.Repository, remov configDgst := digest.FromBytes(config) configReader := bytes.NewReader(config) - var blobDigests []digest.Digest - blobDigests = append(blobDigests, configDgst) - blobs := repository.Blobs(ctx) // push config blob @@ -153,6 +150,8 @@ func checkTestRepository(t *testing.T, repository distribution.Repository, remov }, } + blobDigests := make([]digest.Digest, 0, 3) + blobDigests = append(blobDigests, configDgst) for range 2 { rs, dgst, err := testutil.CreateRandomTarFile() if err != nil { diff --git a/registry/storage/driver/s3-aws/s3_test.go b/registry/storage/driver/s3-aws/s3_test.go index 3e41dd3f0..a4b303d3f 100644 --- a/registry/storage/driver/s3-aws/s3_test.go +++ b/registry/storage/driver/s3-aws/s3_test.go @@ -1051,7 +1051,7 @@ func TestListObjectsV2(t *testing.T) { ctx := dcontext.Background() n := 6 prefix := "/test-list-objects-v2" - var filePaths []string + filePaths := make([]string, 0, n) for i := range n { filePaths = append(filePaths, fmt.Sprintf("%s/%d", prefix, i)) } diff --git a/registry/storage/linkedblobstore_test.go b/registry/storage/linkedblobstore_test.go index 6179f75e5..205c90158 100644 --- a/registry/storage/linkedblobstore_test.go +++ b/registry/storage/linkedblobstore_test.go @@ -21,7 +21,7 @@ func TestLinkedBlobStoreEnumerator(t *testing.T) { fooEnv := newManifestStoreTestEnv(t, fooRepoName, "thetag") ctx := context.Background() - var expected []string + expected := make([]string, 0, 2) for range 2 { rs, dgst, err := testutil.CreateRandomTarFile() if err != nil {