docker/archive/transport.go
func ParseReference(refString string) (types.ImageReference, error) {
	if refString == "" {
		return nil, errors.Errorf("docker-archive reference %s isn't of the form <path>[:<reference>]", refString)
	}

	parts := strings.SplitN(refString, ":", 2)
	path := parts[0]
	var destinationRef reference.NamedTagged

	// A :tag was specified, which is only necessary for destinations.
	if len(parts) == 2 {
		ref, err := reference.ParseNormalizedNamed(parts[1])
		if err != nil {
			return nil, errors.Wrapf(err, "docker-archive parsing reference")
		}
		ref = reference.TagNameOnly(ref)

		if _, isDigest := ref.(reference.Canonical); isDigest {
			return nil, errors.Errorf("docker-archive doesn't support digest references: %s", refString)
		}

		refTagged, isTagged := ref.(reference.NamedTagged)
		if !isTagged {
			// Really shouldn't be hit...
			return nil, errors.Errorf("internal error: reference is not tagged even after reference.TagNameOnly: %s", refString)
		}
		destinationRef = refTagged
	}

	return archiveReference{
		destinationRef: destinationRef,
		path:           path,
	}, nil
}
func ParseReference(refString string) (types.ImageReference, error) {
	if refString == "" {
		return nil, errors.Errorf("docker-archive reference %s isn't of the form <path>[:<reference>]", refString)
	}

	parts := strings.SplitN(refString, ":", 2)
	path := parts[0]
	var destinationRef reference.NamedTagged

	// A :tag was specified, which is only necessary for destinations.
	if len(parts) == 2 {
		ref, err := reference.ParseNormalizedNamed(parts[1])
		if err != nil {
			return nil, errors.Wrapf(err, "docker-archive parsing reference")
		}
		ref = reference.TagNameOnly(ref)

		if _, isDigest := ref.(reference.Canonical); isDigest {
			return nil, errors.Errorf("docker-archive doesn't support digest references: %s", refString)
		}

		refTagged, isTagged := ref.(reference.NamedTagged)
		if !isTagged {
			// Really shouldn't be hit...
			return nil, errors.Errorf("internal error: reference is not tagged even after reference.TagNameOnly: %s", refString)
		}
		destinationRef = refTagged
	}

	return archiveReference{
		destinationRef: destinationRef,
		path:           path,
	}, nil
}
// ParseReference converts a string, which should not start with the ImageTransport.Name prefix, into an Docker ImageReference.