Remove gogoproto.customtype

gogoproto.customtype is used to have go-digest.Digest instead of string.
While it is convinient, protoc-gen-go doesn't support the extension
and that blocks #6564.

Signed-off-by: Kazuyoshi Kato <katokazu@amazon.com>
This commit is contained in:
Kazuyoshi Kato
2022-03-18 21:20:58 +00:00
parent 0c701654a1
commit 3eeeb9429a
22 changed files with 296 additions and 335 deletions

View File

@@ -24,6 +24,7 @@ import (
"github.com/containerd/containerd/diff"
"github.com/containerd/containerd/errdefs"
"github.com/containerd/containerd/mount"
"github.com/opencontainers/go-digest"
ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)
@@ -88,7 +89,7 @@ func (r *diffRemote) Compare(ctx context.Context, a, b []mount.Mount, opts ...di
func toDescriptor(d *types.Descriptor) ocispec.Descriptor {
return ocispec.Descriptor{
MediaType: d.MediaType,
Digest: d.Digest,
Digest: digest.Digest(d.Digest),
Size: d.Size_,
Annotations: d.Annotations,
}
@@ -97,7 +98,7 @@ func toDescriptor(d *types.Descriptor) ocispec.Descriptor {
func fromDescriptor(d ocispec.Descriptor) *types.Descriptor {
return &types.Descriptor{
MediaType: d.MediaType,
Digest: d.Digest,
Digest: d.Digest.String(),
Size_: d.Size,
Annotations: d.Annotations,
}