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:
parent
530974e724
commit
8657c87c8c
1 changed files with 2 additions and 2 deletions
|
@ -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()))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue