diff --git a/bindings-go/apis/v2/accesstypes.go b/bindings-go/apis/v2/accesstypes.go index d283d444..cd34d0be 100644 --- a/bindings-go/apis/v2/accesstypes.go +++ b/bindings-go/apis/v2/accesstypes.go @@ -36,7 +36,7 @@ type OCIRegistryAccess struct { } // NewOCIRegistryAccess creates a new OCIRegistryAccess accessor -func NewOCIRegistryAccess(ref string) TypedObjectAccessor { +func NewOCIRegistryAccess(ref string) *OCIRegistryAccess { return &OCIRegistryAccess{ ObjectType: ObjectType{ Type: OCIRegistryType, @@ -61,7 +61,7 @@ type RelativeOciAccess struct { } // NewRelativeOciAccess creates a new RelativeOciAccess accessor -func NewRelativeOciAccess(ref string) TypedObjectAccessor { +func NewRelativeOciAccess(ref string) *RelativeOciAccess { return &RelativeOciAccess{ ObjectType: ObjectType{ Type: RelativeOciReferenceType, @@ -95,7 +95,7 @@ type OCIBlobAccess struct { } // NewOCIBlobAccess creates a new OCIBlob accessor -func NewOCIBlobAccess(ref, mediaType, digest string, size int64) TypedObjectAccessor { +func NewOCIBlobAccess(ref, mediaType, digest string, size int64) *OCIBlobAccess { return &OCIBlobAccess{ ObjectType: ObjectType{ Type: OCIBlobType, @@ -115,7 +115,7 @@ func (_ *OCIBlobAccess) GetType() string { const LocalOCIBlobType = "localOciBlob" // NewLocalOCIBlobAccess creates a new LocalOCIBlob accessor -func NewLocalOCIBlobAccess(digest string) TypedObjectAccessor { +func NewLocalOCIBlobAccess(digest string) *LocalOCIBlobAccess { return &LocalOCIBlobAccess{ ObjectType: ObjectType{ Type: LocalOCIBlobType, @@ -139,7 +139,7 @@ func (_ *LocalOCIBlobAccess) GetType() string { const LocalFilesystemBlobType = "localFilesystemBlob" // NewLocalFilesystemBlobAccess creates a new localFilesystemBlob accessor. -func NewLocalFilesystemBlobAccess(path string, mediaType string) TypedObjectAccessor { +func NewLocalFilesystemBlobAccess(path string, mediaType string) *LocalFilesystemBlobAccess { return &LocalFilesystemBlobAccess{ ObjectType: ObjectType{ Type: LocalFilesystemBlobType, @@ -175,7 +175,7 @@ type Web struct { } // NewWebAccess creates a new Web accessor -func NewWebAccess(url string) TypedObjectAccessor { +func NewWebAccess(url string) *Web { return &Web{ ObjectType: ObjectType{ Type: OCIBlobType, @@ -205,7 +205,7 @@ type GitHubAccess struct { } // NewGitHubAccess creates a new Web accessor -func NewGitHubAccess(url, ref, commit string) TypedObjectAccessor { +func NewGitHubAccess(url, ref, commit string) *GitHubAccess { return &GitHubAccess{ ObjectType: ObjectType{ Type: GitHubAccessType, diff --git a/bindings-go/apis/v2/repositorytypes.go b/bindings-go/apis/v2/repositorytypes.go index 2c332a26..53f7dcab 100644 --- a/bindings-go/apis/v2/repositorytypes.go +++ b/bindings-go/apis/v2/repositorytypes.go @@ -34,7 +34,7 @@ type OCIRegistryRepository struct { } // NewOCIRegistryRepository creates a new OCIRegistryRepository accessor -func NewOCIRegistryRepository(baseURL string, mapping ComponentNameMapping) Repository { +func NewOCIRegistryRepository(baseURL string, mapping ComponentNameMapping) *OCIRegistryRepository { if len(mapping) == 0 { mapping = OCIRegistryURLPathMapping } diff --git a/bindings-go/ctf/componentarchive.go b/bindings-go/ctf/componentarchive.go index 127b633c..60a872ac 100644 --- a/bindings-go/ctf/componentarchive.go +++ b/bindings-go/ctf/componentarchive.go @@ -278,7 +278,7 @@ func (ca *ComponentArchive) ensureBlobsPath() error { return nil } -// WriteTar tars the current components descriptor and its artifacts. +// WriteTarGzip tars the current components descriptor and its artifacts. func (ca *ComponentArchive) WriteTarGzip(writer io.Writer) error { gw := gzip.NewWriter(writer) if err := ca.WriteTar(gw); err != nil { @@ -458,7 +458,7 @@ func (ca *ComponentArchiveBlobResolver) resolve(_ context.Context, res v2.Resour return nil, nil, UnsupportedResolveType } localFSAccess := &v2.LocalFilesystemBlobAccess{} - if err := v2.NewCodec(nil, nil, nil).Decode(res.Access.Raw, localFSAccess); err != nil { + if err := res.Access.DecodeInto(localFSAccess); err != nil { return nil, nil, fmt.Errorf("unable to decode access to type '%s': %w", res.Access.GetType(), err) } blobpath := BlobPath(localFSAccess.Filename) diff --git a/bindings-go/oci/manifest.go b/bindings-go/oci/manifest.go index cfce3d27..f04cc44a 100644 --- a/bindings-go/oci/manifest.go +++ b/bindings-go/oci/manifest.go @@ -160,7 +160,6 @@ func (b *ManifestBuilder) addLocalBlobs(ctx context.Context) ([]ocispecv1.Descri blobDescriptors := make([]ocispecv1.Descriptor, 0) for i, res := range b.archive.ComponentDescriptor.Resources { - var blob bytes.Buffer info, err := b.archive.Resolve(ctx, res, &blob) if err != nil {