()
| 105 | } |
| 106 | |
| 107 | func (i *ImageReference) String() string { |
| 108 | // An image reference has at most 3 parts (repo, tag, digest) plus 2 separators |
| 109 | parts := make([]string, 0, 5) |
| 110 | parts = append(parts, i.Repository) |
| 111 | if i.Tag != "" { |
| 112 | parts = append(parts, ":", i.Tag) |
| 113 | } |
| 114 | if i.Digest != "" { |
| 115 | parts = append(parts, "@", i.Digest) |
| 116 | } |
| 117 | return strings.Join(parts, "") |
| 118 | } |
| 119 | |
| 120 | // NewImageReference returns an ImageReference instance based on the given url. |
| 121 | func NewImageReference(url string, opts ...name.Option) (*ImageReference, error) { |
no outgoing calls