TagNameOnly adds the default tag "latest" to a reference if it only has a repo name.
(ref Named)
| 154 | // TagNameOnly adds the default tag "latest" to a reference if it only has |
| 155 | // a repo name. |
| 156 | func TagNameOnly(ref Named) Named { |
| 157 | if IsNameOnly(ref) { |
| 158 | namedTagged, err := WithTag(ref, defaultTag) |
| 159 | if err != nil { |
| 160 | // Default tag must be valid, to create a NamedTagged |
| 161 | // type with non-validated input the WithTag function |
| 162 | // should be used instead |
| 163 | panic(err) |
| 164 | } |
| 165 | return namedTagged |
| 166 | } |
| 167 | return ref |
| 168 | } |
| 169 | |
| 170 | // ParseAnyReference parses a reference string as a possible identifier, |
| 171 | // full digest, or familiar name. |
no test coverage detected
searching dependent graphs…