diff --git a/testutil/manifests.go b/testutil/manifests.go index cf80bb47..6a3a2e6f 100644 --- a/testutil/manifests.go +++ b/testutil/manifests.go @@ -42,7 +42,7 @@ func MakeManifestList(blobstatter distribution.BlobStatter, manifestDigests []di // MakeSchema1Manifest constructs a schema 1 manifest from a given list of digests and returns // the digest of the manifest func MakeSchema1Manifest(digests []digest.Digest) (distribution.Manifest, error) { - manifest := schema1.Manifest{ + mfst := schema1.Manifest{ Versioned: manifest.Versioned{ SchemaVersion: 1, }, @@ -50,9 +50,9 @@ func MakeSchema1Manifest(digests []digest.Digest) (distribution.Manifest, error) Tag: "cares", } - for _, digest := range digests { - manifest.FSLayers = append(manifest.FSLayers, schema1.FSLayer{BlobSum: digest}) - manifest.History = append(manifest.History, schema1.History{V1Compatibility: ""}) + for _, d := range digests { + mfst.FSLayers = append(mfst.FSLayers, schema1.FSLayer{BlobSum: d}) + mfst.History = append(mfst.History, schema1.History{V1Compatibility: ""}) } pk, err := libtrust.GenerateECP256PrivateKey() @@ -60,7 +60,7 @@ func MakeSchema1Manifest(digests []digest.Digest) (distribution.Manifest, error) return nil, fmt.Errorf("unexpected error generating private key: %v", err) } - signedManifest, err := schema1.Sign(&manifest, pk) + signedManifest, err := schema1.Sign(&mfst, pk) if err != nil { return nil, fmt.Errorf("error signing manifest: %v", err) } @@ -74,14 +74,14 @@ func MakeSchema2Manifest(repository distribution.Repository, digests []digest.Di ctx := context.Background() blobStore := repository.Blobs(ctx) builder := schema2.NewManifestBuilder(blobStore, schema2.MediaTypeImageConfig, []byte{}) - for _, digest := range digests { - builder.AppendReference(distribution.Descriptor{Digest: digest}) + for _, d := range digests { + builder.AppendReference(distribution.Descriptor{Digest: d}) } - manifest, err := builder.Build(ctx) + mfst, err := builder.Build(ctx) if err != nil { return nil, fmt.Errorf("unexpected error generating manifest: %v", err) } - return manifest, nil + return mfst, nil } diff --git a/testutil/tarfile.go b/testutil/tarfile.go index 6a9c9a07..e0782b73 100644 --- a/testutil/tarfile.go +++ b/testutil/tarfile.go @@ -96,7 +96,7 @@ func CreateRandomLayers(n int) (map[digest.Digest]io.ReadSeeker, error) { // UploadBlobs lets you upload blobs to a repository func UploadBlobs(repository distribution.Repository, layers map[digest.Digest]io.ReadSeeker) error { ctx := context.Background() - for digest, rs := range layers { + for dgst, rs := range layers { wr, err := repository.Blobs(ctx).Create(ctx) if err != nil { return fmt.Errorf("unexpected error creating upload: %v", err) @@ -106,7 +106,7 @@ func UploadBlobs(repository distribution.Repository, layers map[digest.Digest]io return fmt.Errorf("unexpected error copying to upload: %v", err) } - if _, err := wr.Commit(ctx, distribution.Descriptor{Digest: digest}); err != nil { + if _, err := wr.Commit(ctx, distribution.Descriptor{Digest: dgst}); err != nil { return fmt.Errorf("unexpected error committinng upload: %v", err) } }