Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -24,7 +24,7 @@ func (cli *Client) ContainerCommit(ctx context.Context, containerID string, opti |
| 24 | 24 |
return container.CommitResponse{}, err
|
| 25 | 25 |
} |
| 26 | 26 |
|
| 27 |
- if _, isCanonical := ref.(reference.Canonical); isCanonical {
|
|
| 27 |
+ if _, ok := ref.(reference.Digested); ok {
|
|
| 28 | 28 |
return container.CommitResponse{}, errors.New("refusing to create a tag with a digest reference")
|
| 29 | 29 |
} |
| 30 | 30 |
ref = reference.TagNameOnly(ref) |
| ... | ... |
@@ -25,7 +25,7 @@ func (cli *Client) ImagePush(ctx context.Context, image string, options image.Pu |
| 25 | 25 |
return nil, err |
| 26 | 26 |
} |
| 27 | 27 |
|
| 28 |
- if _, isCanonical := ref.(reference.Canonical); isCanonical {
|
|
| 28 |
+ if _, ok := ref.(reference.Digested); ok {
|
|
| 29 | 29 |
return nil, errors.New("cannot push a digest reference")
|
| 30 | 30 |
} |
| 31 | 31 |
|
| ... | ... |
@@ -20,7 +20,7 @@ func (cli *Client) ImageTag(ctx context.Context, source, target string) error {
|
| 20 | 20 |
return fmt.Errorf("error parsing reference: %q is not a valid repository/tag: %w", target, err)
|
| 21 | 21 |
} |
| 22 | 22 |
|
| 23 |
- if _, isCanonical := ref.(reference.Canonical); isCanonical {
|
|
| 23 |
+ if _, ok := ref.(reference.Digested); ok {
|
|
| 24 | 24 |
return errors.New("refusing to create a tag with a digest reference")
|
| 25 | 25 |
} |
| 26 | 26 |
|
| ... | ... |
@@ -154,7 +154,7 @@ func imageDigestAndPlatforms(ctx context.Context, cli DistributionAPIClient, ima |
| 154 | 154 |
func imageWithDigestString(image string, dgst digest.Digest) string {
|
| 155 | 155 |
namedRef, err := reference.ParseNormalizedNamed(image) |
| 156 | 156 |
if err == nil {
|
| 157 |
- if _, isCanonical := namedRef.(reference.Canonical); !isCanonical {
|
|
| 157 |
+ if _, hasDigest := namedRef.(reference.Digested); !hasDigest {
|
|
| 158 | 158 |
// ensure that image gets a default tag if none is provided |
| 159 | 159 |
img, err := reference.WithDigest(namedRef, dgst) |
| 160 | 160 |
if err == nil {
|