docker: reference: load sha256 explicitly

There has been a change in upstream (docker/distribution), where they
now require users of the digest library to load algorithms into the
binary (in other words they do .Available checks on crypto algorithms).

This fixes the unit test failures with "unsupported digest algorithm".

Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
Aleksa Sarai 2016-12-21 17:48:49 +11:00
parent 23dbcf1b2b
commit d0a45e907a
No known key found for this signature in database
GPG Key ID: 9E18AA267DDB8DB4
2 changed files with 5 additions and 1 deletions

View File

@ -6,6 +6,9 @@ import (
"github.com/pkg/errors"
// "docker/distribution/digest" requires us to load the algorithms that we
// want to use into the binary (it calls .Available).
_ "crypto/sha256"
"github.com/docker/distribution/digest"
distreference "github.com/docker/distribution/reference"
)
@ -55,7 +58,7 @@ type Canonical interface {
func ParseNamed(s string) (Named, error) {
named, err := distreference.ParseNamed(s)
if err != nil {
return nil, errors.Errorf("Error parsing reference: %q is not a valid repository/tag", s)
return nil, errors.Wrapf(err, "Error parsing reference: %q is not a valid repository/tag", s)
}
r, err := WithName(named.Name())
if err != nil {

View File

@ -3,6 +3,7 @@ package reference
import (
"testing"
_ "crypto/sha256"
"github.com/docker/distribution/digest"
)