mirror of
https://github.com/moby/moby.git
synced 2026-07-25 00:37:00 +00:00
c8d/tag: Don't create a separate error variable
Checking if the image creation failed due to IsAlreadyExists didn't use the error from ImageService.Create. Error from ImageService.Create was stored in a separate variable and later IsAlreadyExists checked the standard `err` variable instead of the `createErr`. As there's no need to store the error in a separate variable - just assign it to err variable and fix the check. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
This commit is contained in:
@@ -25,8 +25,8 @@ func (i *ImageService) TagImage(ctx context.Context, imageID image.ID, newTag re
|
||||
}
|
||||
|
||||
is := i.client.ImageService()
|
||||
_, createErr := is.Create(ctx, newImg)
|
||||
if createErr != nil {
|
||||
_, err = is.Create(ctx, newImg)
|
||||
if err != nil {
|
||||
if !cerrdefs.IsAlreadyExists(err) {
|
||||
return errdefs.System(errors.Wrapf(err, "failed to create image with name %s and target %s", newImg.Name, newImg.Target.Digest.String()))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user