mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
fix go-digest to make sure the algorithms are registered
Previously, ioutils imported the crypty/sha256 package, because it was used by the HashData() utility. As a side-effect of that import, the sha256 algorithm was registered through its `init()` function. Now that the HashData() utility is removed, the import is no longer needed in this package, but some parts of our code depended on the side-effect, and without this, it fail to recognise the algorithms, unless something else happens to import crypto/sha256 / crypto/sha512, which made our tests fail: ``` === Failed === FAIL: reference TestLoad (0.00s) store_test.go:53: failed to parse reference: unsupported digest algorithm === FAIL: reference TestSave (0.00s) store_test.go:82: failed to parse reference: unsupported digest algorithm === FAIL: reference TestAddDeleteGet (0.00s) store_test.go:174: could not parse reference: unsupported digest algorithm === FAIL: reference TestInvalidTags (0.00s) store_test.go:355: assertion failed: error is not nil: unsupported digest algorithm ``` While it would be better to do the import in the actual locations where it's expected, there may be code-paths we overlook, so instead adding the import here temporarily. Until the PR in go-digest has been merged and released. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
572498be56
commit
98caf09f0f
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,11 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils"
|
|||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
// make sure crypto.SHA256, crypto.sha512 and crypto.SHA384 are registered
|
||||
// TODO remove once https://github.com/opencontainers/go-digest/pull/64 is merged.
|
||||
_ "crypto/sha256"
|
||||
_ "crypto/sha512"
|
||||
)
|
||||
|
||||
// ReadCloserWrapper wraps an io.Reader, and implements an io.ReadCloser
|
||||
|
|
Loading…
Reference in a new issue