1
0
mirror of https://github.com/regclient/regclient.git synced 2025-07-30 20:03:04 +03:00

Refactoring the type package

I feel like I need to explain, this is all to move the descriptor package.
The platform package could not use the predefined errors in types because of a circular dependency from descriptor.
The most appropriate way to reorg this is to move descriptor out of the type package since it was more complex than a self contained type.
When doing that, type aliases were needed to avoid breaking changes to existing users.
Those aliases themselves caused circular dependency loops because of the media types and errors, so those were also pulled out to separate packages.
All of the old values were aliased and deprecated, and to fix the linter, those deprecations were fixed by updating the imports... everywhere.

Signed-off-by: Brandon Mitchell <git@bmitch.net>
This commit is contained in:
Brandon Mitchell
2024-03-04 15:43:18 -05:00
parent b991f53ad7
commit eea06e2a5c
108 changed files with 2529 additions and 1721 deletions

View File

@ -9,7 +9,7 @@ import (
"github.com/opencontainers/go-digest"
"github.com/regclient/regclient/types"
"github.com/regclient/regclient/types/descriptor"
"github.com/regclient/regclient/types/ref"
)
@ -19,14 +19,14 @@ type Common = *BCommon
// BCommon is a common struct for all blobs which includes various shared methods.
type BCommon struct {
r ref.Ref
desc types.Descriptor
desc descriptor.Descriptor
blobSet bool
rawHeader http.Header
resp *http.Response
}
// GetDescriptor returns the descriptor associated with the blob.
func (c *BCommon) GetDescriptor() types.Descriptor {
func (c *BCommon) GetDescriptor() descriptor.Descriptor {
return c.desc
}