Signed-off-by: yupengzte <yu.peng36@zte.com.cn>
| ... | ... |
@@ -55,12 +55,9 @@ func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec, |
| 55 | 55 |
// the image string if it didn't originally contain a digest. It assumes |
| 56 | 56 |
// that the image string is not an image ID |
| 57 | 57 |
func imageWithDigestString(image string, dgst digest.Digest) string {
|
| 58 |
- isCanonical := false |
|
| 59 | 58 |
ref, err := reference.ParseAnyReference(image) |
| 60 | 59 |
if err == nil {
|
| 61 |
- _, isCanonical = ref.(reference.Canonical) |
|
| 62 |
- |
|
| 63 |
- if !isCanonical {
|
|
| 60 |
+ if _, isCanonical := ref.(reference.Canonical); !isCanonical {
|
|
| 64 | 61 |
namedRef, _ := ref.(reference.Named) |
| 65 | 62 |
img, err := reference.WithDigest(namedRef, dgst) |
| 66 | 63 |
if err == nil {
|