pkg/reference: remove deprecated SplitObject

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2024-06-28 18:45:43 +02:00
parent fec33aa735
commit a723c0c6ea
2 changed files with 0 additions and 53 deletions

View File

@@ -154,26 +154,3 @@ func (r Spec) String() string {
return r.Locator + ":" + r.Object
}
// SplitObject provides two parts of the object spec, delimited by an "@"
// symbol. It does not perform any validation on correctness of the values
// returned, and it's the callers' responsibility to validate the result.
//
// If an "@" delimiter is found, it returns the part *including* the "@"
// delimiter as "tag", and the part after the "@" as digest.
//
// The example below produces "docker.io/library/ubuntu:latest@" and
// "sha256:deadbeef";
//
// t, d := SplitObject("docker.io/library/ubuntu:latest@sha256:deadbeef")
// fmt.Println(t) // docker.io/library/ubuntu:latest@
// fmt.Println(d) // sha256:deadbeef
//
// Deprecated: use [Parse] and [Spec.Digest] instead.
func SplitObject(obj string) (tag string, dgst digest.Digest) {
if i := strings.Index(obj, "@"); i >= 0 {
// Offset by one so preserve the "@" in the tag returned.
return obj[:i+1], digest.Digest(obj[i+1:])
}
return obj, ""
}