diff --git a/ref/ref.go b/ref/ref.go index 3e2fdfc..776124e 100644 --- a/ref/ref.go +++ b/ref/ref.go @@ -183,16 +183,12 @@ func (r ContainerImageReference) ResolveDigest() (*ContainerImageReference, erro return nil, err } - img, err := remote.Image(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain)) - if err != nil { - return nil, err - } - digest, err := img.Digest() + descriptor, err := remote.Get(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain)) if err != nil { return nil, fmt.Errorf("failed to get Digest for %s, %s", r, err) } - return &ContainerImageReference{Name: r.Name, Tag: r.Tag, Digest: digest.String()}, nil + return &ContainerImageReference{Name: r.Name, Tag: r.Tag, Digest: descriptor.Digest.String()}, nil } func (r *ContainerImageReference) SetTag(tag string) { diff --git a/ref/resolve_test.go b/ref/resolve_test.go index d86ae57..9e8a4e6 100644 --- a/ref/resolve_test.go +++ b/ref/resolve_test.go @@ -19,14 +19,11 @@ func TestImageResolve(t *testing.T) { t.Fatal(err) } - img, err := remote.Image(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain)) - if err != nil { - t.Fatal(err) - } - digest, err := img.Digest() + descriptor, err := remote.Get(ref, remote.WithAuthFromKeychain(authn.DefaultKeychain)) if err != nil { t.Fatal(err) } + digest := descriptor.Digest if digest.String() != rr.Digest { t.Fatalf("expected %s, got %s", digest, rr.Digest)