mirror of
https://github.com/containers/skopeo.git
synced 2025-10-08 13:19:05 +00:00
Does not change behavior. This is a straightforward move and update of package references, except for: - Adding a duplicate definition of manifestSchema1 to cmd/skopeo/copy.go. This will need to be cleaned up later, for now preferring to make no design changes in this commit. - Renaming parseDockerImage to NewDockerImage, to both make it public and consistent with common golang conventions.
23 lines
538 B
Go
23 lines
538 B
Go
package docker
|
|
|
|
import "github.com/projectatomic/skopeo/reference"
|
|
|
|
// parseDockerImageName converts a string into a reference and tag value.
|
|
func parseDockerImageName(img string) (reference.Named, string, error) {
|
|
ref, err := reference.ParseNamed(img)
|
|
if err != nil {
|
|
return nil, "", err
|
|
}
|
|
if reference.IsNameOnly(ref) {
|
|
ref = reference.WithDefaultTag(ref)
|
|
}
|
|
var tag string
|
|
switch x := ref.(type) {
|
|
case reference.Canonical:
|
|
tag = x.Digest().String()
|
|
case reference.NamedTagged:
|
|
tag = x.Tag()
|
|
}
|
|
return ref, tag, nil
|
|
}
|