func Digest(i WithRawManifest) (v1.Hash, error) {
	mb, err := i.RawManifest()
	if err != nil {
		return v1.Hash{}, err
	}
	digest, _, err := v1.SHA256(bytes.NewReader(mb))
	return digest, err
}
Digest is a helper for implementing v1.Image
package partial
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	v1 "github.com/google/go-containerregistry/pkg/v1"
	"github.com/google/go-containerregistry/pkg/v1/v1util"
)
type WithRawConfigFile interface {
	RawConfigFile() ([]byte, error)
}
func ConfigFile(i WithRawConfigFile) (*v1.ConfigFile, error) {
	b, err := i.RawConfigFile()
	if err != nil {
		return nil, err
	}
	return v1.ParseConfigFile(bytes.NewReader(b))
}
func ConfigName(i WithRawConfigFile) (v1.Hash, error) {
	b, err := i.RawConfigFile()
	if err != nil {
		return v1.Hash{}, err
	}
	h, _, err := v1.SHA256(bytes.NewReader(b))
	return h, err
}
type configLayer struct {
	hash    v1.Hash
	content []byte
}
func (cl *configLayer) Digest() (v1.Hash, error) {
	return cl.hash, nil
}
func (cl *configLayer) DiffID() (v1.Hash, error) {
	return cl.hash, nil
}
func (cl *configLayer) Uncompressed() (io.ReadCloser, error) {
	return ioutil.NopCloser(bytes.NewBuffer(cl.content)), nil
}
func (cl *configLayer) Compressed() (io.ReadCloser, error) {
	return ioutil.NopCloser(bytes.NewBuffer(cl.content)), nil
}
func (cl *configLayer) Size() (int64, error) {
	return int64(len(cl.content)), nil
}
var _ v1.Layer = (*configLayer)(nil)
func ConfigLayer(i WithRawConfigFile) (v1.Layer, error) {
	h, err := ConfigName(i)
	if err != nil {
		return nil, err
	}
	rcfg, err := i.RawConfigFile()
	if err != nil {
		return nil, err
	}
	return &configLayer{
		hash:    h,
		content: rcfg,
	}, nil
}
type WithConfigFile interface {
	ConfigFile() (*v1.ConfigFile, error)
}
func DiffIDs(i WithConfigFile) ([]v1.Hash, error) {
	cfg, err := i.ConfigFile()
	if err != nil {
		return nil, err
	}
	return cfg.RootFS.DiffIDs, nil
}
func RawConfigFile(i WithConfigFile) ([]byte, error) {
	cfg, err := i.ConfigFile()
	if err != nil {
		return nil, err
	}
	return json.Marshal(cfg)
}
type WithUncompressedLayer interface {
	UncompressedLayer(v1.Hash) (io.ReadCloser, error)
}
func Layer(wul WithUncompressedLayer, h v1.Hash) (io.ReadCloser, error) {
	rc, err := wul.UncompressedLayer(h)
	if err != nil {
		return nil, err
	}
	return v1util.GzipReadCloser(rc)
}
type WithRawManifest interface {
	RawManifest() ([]byte, error)
}