From dafd212870585313442de0342c5455ef42099d5e Mon Sep 17 00:00:00 2001 From: Miloslav Trmač Date: Fri, 7 Feb 2020 02:37:36 +0100 Subject: Modify Runtime.getImage to return a storage.Image MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... because both callers only care about that aspect of the return value. Signed-off-by: Miloslav Trmač --- libpod/image/image.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libpod/image/image.go b/libpod/image/image.go index ddde1c8da..43fd52a1a 100644 --- a/libpod/image/image.go +++ b/libpod/image/image.go @@ -218,7 +218,7 @@ func (i *Image) reloadImage() error { if err != nil { return errors.Wrapf(err, "unable to reload image") } - i.image = newImage.image + i.image = newImage return nil } @@ -245,7 +245,7 @@ func (ir *Runtime) getLocalImage(inputName string) (string, *storage.Image, erro img, err := ir.getImage(stripSha256(inputName)) if err == nil { - return inputName, img.image, err + return inputName, img, err } // container-storage wasn't able to find it in its current form @@ -269,7 +269,7 @@ func (ir *Runtime) getLocalImage(inputName string) (string, *storage.Image, erro } img, err = ir.getImage(ref.String()) if err == nil { - return inputName, img.image, err + return inputName, img, err } // grab all the local images @@ -444,7 +444,7 @@ func (i *Image) Remove(ctx context.Context, force bool) error { // getImage retrieves an image matching the given name or hash from system // storage // If no matching image can be found, an error is returned -func (ir *Runtime) getImage(image string) (*Image, error) { +func (ir *Runtime) getImage(image string) (*storage.Image, error) { var img *storage.Image ref, err := is.Transport.ParseStoreReference(ir.store, image) if err == nil { @@ -460,8 +460,7 @@ func (ir *Runtime) getImage(image string) (*Image, error) { } img = img2 } - newImage := ir.newFromStorage(img) - return newImage, nil + return img, nil } // GetImages retrieves all images present in storage -- cgit v1.2.3-54-g00ecf