pkg/reference: Spec.Digest(): inline SplitObject code
Inline the relevant code from SplitObject, as we're only interested in the digest portion. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
42145950bb
commit
a5fce38f31
@ -135,8 +135,12 @@ func (r Spec) Hostname() string {
|
|||||||
// Digest returns the digest portion of the reference spec. This may be a
|
// Digest returns the digest portion of the reference spec. This may be a
|
||||||
// partial or invalid digest, which may be used to lookup a complete digest.
|
// partial or invalid digest, which may be used to lookup a complete digest.
|
||||||
func (r Spec) Digest() digest.Digest {
|
func (r Spec) Digest() digest.Digest {
|
||||||
_, dgst := SplitObject(r.Object)
|
i := strings.Index(r.Object, "@")
|
||||||
return dgst
|
|
||||||
|
if i < 0 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return digest.Digest(r.Object[i+1:])
|
||||||
}
|
}
|
||||||
|
|
||||||
// String returns the normalized string for the ref.
|
// String returns the normalized string for the ref.
|
||||||
|
Loading…
Reference in New Issue
Block a user