*: use opencontainers/go-digest package

The `digest` data type, used throughout docker for image verification
and identity, has been broken out into `opencontainers/go-digest`. This
PR updates the dependencies and moves uses over to the new type.

Signed-off-by: Stephen J Day <stephen.day@docker.com>
This commit is contained in:
Stephen J Day 2017-01-06 17:23:18 -08:00
parent 567b554540
commit 5d67ac20cb
3 changed files with 5 additions and 5 deletions

View File

@ -10,7 +10,6 @@ import (
"sort" "sort"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest"
"github.com/docker/docker/api/types" "github.com/docker/docker/api/types"
"github.com/docker/docker/cli/command" "github.com/docker/docker/cli/command"
"github.com/docker/docker/cli/trust" "github.com/docker/docker/cli/trust"
@ -19,6 +18,7 @@ import (
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/docker/notary/client" "github.com/docker/notary/client"
"github.com/docker/notary/tuf/data" "github.com/docker/notary/tuf/data"
"github.com/opencontainers/go-digest"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -58,7 +58,7 @@ func PushTrustedReference(cli *command.DockerCli, repoInfo *registry.RepositoryI
var pushResult types.PushResult var pushResult types.PushResult
err := json.Unmarshal(*aux, &pushResult) err := json.Unmarshal(*aux, &pushResult)
if err == nil && pushResult.Tag != "" { if err == nil && pushResult.Tag != "" {
if dgst, err := digest.ParseDigest(pushResult.Digest); err == nil { if dgst, err := digest.Parse(pushResult.Digest); err == nil {
h, err := hex.DecodeString(dgst.Hex()) h, err := hex.DecodeString(dgst.Hex())
if err != nil { if err != nil {
target = nil target = nil

View File

@ -5,7 +5,6 @@ import (
"fmt" "fmt"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
"github.com/docker/distribution/digest"
distreference "github.com/docker/distribution/reference" distreference "github.com/docker/distribution/reference"
"github.com/docker/docker/api/types/swarm" "github.com/docker/docker/api/types/swarm"
"github.com/docker/docker/cli/command" "github.com/docker/docker/cli/command"
@ -13,6 +12,7 @@ import (
"github.com/docker/docker/reference" "github.com/docker/docker/reference"
"github.com/docker/docker/registry" "github.com/docker/docker/registry"
"github.com/docker/notary/tuf/data" "github.com/docker/notary/tuf/data"
"github.com/opencontainers/go-digest"
"github.com/pkg/errors" "github.com/pkg/errors"
"golang.org/x/net/context" "golang.org/x/net/context"
) )
@ -30,7 +30,7 @@ func resolveServiceImageDigest(dockerCli *command.DockerCli, service *swarm.Serv
// could be parsed as a digest reference. Specifying an image ID // could be parsed as a digest reference. Specifying an image ID
// is valid but not resolvable. There is no warning message for // is valid but not resolvable. There is no warning message for
// an image ID because it's valid to use one. // an image ID because it's valid to use one.
if _, err := digest.ParseDigest(image); err == nil { if _, err := digest.Parse(image); err == nil {
return nil return nil
} }

View File

@ -182,6 +182,7 @@ type bintree struct {
Func func() (*asset, error) Func func() (*asset, error)
Children map[string]*bintree Children map[string]*bintree
} }
var _bintree = &bintree{nil, map[string]*bintree{ var _bintree = &bintree{nil, map[string]*bintree{
"data": &bintree{nil, map[string]*bintree{ "data": &bintree{nil, map[string]*bintree{
"config_schema_v3.0.json": &bintree{dataConfig_schema_v30Json, map[string]*bintree{}}, "config_schema_v3.0.json": &bintree{dataConfig_schema_v30Json, map[string]*bintree{}},
@ -234,4 +235,3 @@ func _filePath(dir, name string) string {
cannonicalName := strings.Replace(name, "\\", "/", -1) cannonicalName := strings.Replace(name, "\\", "/", -1)
return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...)
} }