mirror of
https://github.com/crazy-max/diun.git
synced 2025-12-25 14:59:33 +01:00
fix: set Image receiver as pointer
This commit is contained in:
@@ -29,32 +29,6 @@ type ParseImageOptions struct {
|
||||
HubTpl string
|
||||
}
|
||||
|
||||
// Name returns the full name representation of an image.
|
||||
func (i Image) Name() string {
|
||||
return i.named.Name()
|
||||
}
|
||||
|
||||
// String returns the string representation of an image.
|
||||
func (i Image) String() string {
|
||||
return i.named.String()
|
||||
}
|
||||
|
||||
// Reference returns either the digest if it is non-empty or the tag for the image.
|
||||
func (i Image) Reference() string {
|
||||
if len(i.Digest.String()) > 1 {
|
||||
return i.Digest.String()
|
||||
}
|
||||
|
||||
return i.Tag
|
||||
}
|
||||
|
||||
// WithDigest sets the digest for an image.
|
||||
func (i *Image) WithDigest(digest digest.Digest) (err error) {
|
||||
i.Digest = digest
|
||||
i.named, err = reference.WithDigest(i.named, digest)
|
||||
return err
|
||||
}
|
||||
|
||||
// ParseImage returns an Image struct with all the values filled in for a given image.
|
||||
func ParseImage(parseOpts ParseImageOptions) (Image, error) {
|
||||
// Parse the image name and tag.
|
||||
@@ -91,7 +65,33 @@ func ParseImage(parseOpts ParseImageOptions) (Image, error) {
|
||||
return i, nil
|
||||
}
|
||||
|
||||
func (i Image) hubLink() (string, error) {
|
||||
// Name returns the full name representation of an image.
|
||||
func (i *Image) Name() string {
|
||||
return i.named.Name()
|
||||
}
|
||||
|
||||
// String returns the string representation of an image.
|
||||
func (i *Image) String() string {
|
||||
return i.named.String()
|
||||
}
|
||||
|
||||
// Reference returns either the digest if it is non-empty or the tag for the image.
|
||||
func (i *Image) Reference() string {
|
||||
if len(i.Digest.String()) > 1 {
|
||||
return i.Digest.String()
|
||||
}
|
||||
|
||||
return i.Tag
|
||||
}
|
||||
|
||||
// WithDigest sets the digest for an image.
|
||||
func (i *Image) WithDigest(digest digest.Digest) (err error) {
|
||||
i.Digest = digest
|
||||
i.named, err = reference.WithDigest(i.named, digest)
|
||||
return err
|
||||
}
|
||||
|
||||
func (i *Image) hubLink() (string, error) {
|
||||
if i.opts.HubTpl != "" {
|
||||
var out bytes.Buffer
|
||||
tmpl, err := template.New("tmpl").
|
||||
|
||||
Reference in New Issue
Block a user