Merge pull request #33267 from YuPengZTE/devImageWithDigestString

ineffectual assignment to isCanonical, delete it, and make the "if" sentence to fit the golang usage
This commit is contained in:
Sebastiaan van Stijn 2017-05-18 23:37:52 +02:00 committed by GitHub
commit b0dd3dfc11
1 changed files with 1 additions and 4 deletions

View File

@ -58,12 +58,9 @@ func (cli *Client) ServiceCreate(ctx context.Context, service swarm.ServiceSpec,
// the image string if it didn't originally contain a digest. It assumes
// that the image string is not an image ID
func imageWithDigestString(image string, dgst digest.Digest) string {
isCanonical := false
ref, err := reference.ParseAnyReference(image)
if err == nil {
_, isCanonical = ref.(reference.Canonical)
if !isCanonical {
if _, isCanonical := ref.(reference.Canonical); !isCanonical {
namedRef, _ := ref.(reference.Named)
img, err := reference.WithDigest(namedRef, dgst)
if err == nil {