Skip to content

Commit 831269d

Browse files
committed
Rename an options variable to imgOptions
... because we will add a parameter named "options". Should not change behavior. Signed-off-by: Miloslav Trmač <[email protected]>
1 parent ba2a4ae commit 831269d

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

storage/storage_dest.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,10 +1190,10 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
11901190

11911191
// If one of those blobs was a configuration blob, then we can try to dig out the date when the image
11921192
// was originally created, in case we're just copying it. If not, no harm done.
1193-
options := &storage.ImageOptions{}
1193+
imgOptions := &storage.ImageOptions{}
11941194
if inspect, err := man.Inspect(s.getConfigBlob); err == nil && inspect.Created != nil {
11951195
logrus.Debugf("setting image creation date to %s", inspect.Created)
1196-
options.CreationDate = *inspect.Created
1196+
imgOptions.CreationDate = *inspect.Created
11971197
}
11981198

11991199
// Set up to save the non-layer blobs as data items. Since we only share layers, they should all be in files, so
@@ -1210,7 +1210,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12101210
if err != nil {
12111211
return fmt.Errorf("copying non-layer blob %q to image: %w", blob, err)
12121212
}
1213-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1213+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12141214
Key: blob.String(),
12151215
Data: v,
12161216
Digest: digest.Canonical.FromBytes(v),
@@ -1227,7 +1227,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12271227
if err != nil {
12281228
return err
12291229
}
1230-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1230+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12311231
Key: key,
12321232
Data: toplevelManifest,
12331233
Digest: manifestDigest,
@@ -1240,19 +1240,19 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12401240
if err != nil {
12411241
return err
12421242
}
1243-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1243+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12441244
Key: key,
12451245
Data: s.manifest,
12461246
Digest: s.manifestDigest,
12471247
})
1248-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1248+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12491249
Key: storage.ImageDigestBigDataKey,
12501250
Data: s.manifest,
12511251
Digest: s.manifestDigest,
12521252
})
12531253
// Set up to save the signatures, if we have any.
12541254
if len(s.signatures) > 0 {
1255-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1255+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12561256
Key: "signatures",
12571257
Data: s.signatures,
12581258
Digest: digest.Canonical.FromBytes(s.signatures),
@@ -1263,7 +1263,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12631263
if err != nil {
12641264
return err
12651265
}
1266-
options.BigData = append(options.BigData, storage.ImageBigDataOption{
1266+
imgOptions.BigData = append(imgOptions.BigData, storage.ImageBigDataOption{
12671267
Key: key,
12681268
Data: signatures,
12691269
Digest: digest.Canonical.FromBytes(signatures),
@@ -1276,7 +1276,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12761276
return fmt.Errorf("encoding metadata for image: %w", err)
12771277
}
12781278
if len(metadata) != 0 {
1279-
options.Metadata = string(metadata)
1279+
imgOptions.Metadata = string(metadata)
12801280
}
12811281

12821282
// Create the image record, pointing to the most-recently added layer.
@@ -1288,7 +1288,7 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
12881288
}
12891289
}
12901290
oldNames := []string{}
1291-
img, err := s.imageRef.transport.store.CreateImage(intendedID, nil, lastLayer, "", options)
1291+
img, err := s.imageRef.transport.store.CreateImage(intendedID, nil, lastLayer, "", imgOptions)
12921292
if err != nil {
12931293
if !errors.Is(err, storage.ErrDuplicateID) {
12941294
logrus.Debugf("error creating image: %q", err)
@@ -1309,21 +1309,21 @@ func (s *storageImageDestination) Commit(ctx context.Context, unparsedToplevel t
13091309
// sizes (tracked in the metadata) which might have already
13101310
// been present with new values, when ideally we'd find a way
13111311
// to merge them since they all apply to the same image
1312-
for _, data := range options.BigData {
1312+
for _, data := range imgOptions.BigData {
13131313
if err := s.imageRef.transport.store.SetImageBigData(img.ID, data.Key, data.Data, manifest.Digest); err != nil {
13141314
logrus.Debugf("error saving big data %q for image %q: %v", data.Key, img.ID, err)
13151315
return fmt.Errorf("saving big data %q for image %q: %w", data.Key, img.ID, err)
13161316
}
13171317
}
1318-
if options.Metadata != "" {
1319-
if err := s.imageRef.transport.store.SetMetadata(img.ID, options.Metadata); err != nil {
1318+
if imgOptions.Metadata != "" {
1319+
if err := s.imageRef.transport.store.SetMetadata(img.ID, imgOptions.Metadata); err != nil {
13201320
logrus.Debugf("error saving metadata for image %q: %v", img.ID, err)
13211321
return fmt.Errorf("saving metadata for image %q: %w", img.ID, err)
13221322
}
1323-
logrus.Debugf("saved image metadata %q", options.Metadata)
1323+
logrus.Debugf("saved image metadata %q", imgOptions.Metadata)
13241324
}
13251325
} else {
1326-
logrus.Debugf("created new image ID %q with metadata %q", img.ID, options.Metadata)
1326+
logrus.Debugf("created new image ID %q with metadata %q", img.ID, imgOptions.Metadata)
13271327
}
13281328

13291329
// Clean up the unfinished image on any error.

0 commit comments

Comments
 (0)