mirror of
https://github.com/containers/podman.git
synced 2025-11-02 14:55:28 +08:00
Vendor in latest containers(common, storage,image, buildah)
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
20
vendor/github.com/google/go-containerregistry/pkg/name/digest.go
generated
vendored
20
vendor/github.com/google/go-containerregistry/pkg/name/digest.go
generated
vendored
@ -17,6 +17,7 @@ package name
|
||||
import (
|
||||
// nolint: depguard
|
||||
_ "crypto/sha256" // Recommended by go-digest.
|
||||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/opencontainers/go-digest"
|
||||
@ -59,6 +60,25 @@ func (d Digest) String() string {
|
||||
return d.original
|
||||
}
|
||||
|
||||
// MarshalJSON formats the digest into a string for JSON serialization.
|
||||
func (d Digest) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(d.String())
|
||||
}
|
||||
|
||||
// UnmarshalJSON parses a JSON string into a Digest.
|
||||
func (d *Digest) UnmarshalJSON(data []byte) error {
|
||||
var s string
|
||||
if err := json.Unmarshal(data, &s); err != nil {
|
||||
return err
|
||||
}
|
||||
n, err := NewDigest(s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
*d = n
|
||||
return nil
|
||||
}
|
||||
|
||||
// NewDigest returns a new Digest representing the given name.
|
||||
func NewDigest(name string, opts ...Option) (Digest, error) {
|
||||
// Split on "@"
|
||||
|
||||
Reference in New Issue
Block a user