summaryrefslogtreecommitdiff
path: root/pkg/ioutils
diff options
context:
space:
mode:
authorSebastiaan van Stijn <github@gone.nl>2021-08-18 13:23:06 +0200
committerSebastiaan van Stijn <github@gone.nl>2021-08-20 00:35:39 +0200
commit572498be565ab8312e2b2b721f252cc5b38c470e (patch)
tree0c8f66de6cb917ed40f9359e8117115b748bb25f /pkg/ioutils
parentc21be64e1afcbe9b0995f59c9bf77172d1a195d3 (diff)
downloaddocker-572498be565ab8312e2b2b721f252cc5b38c470e.tar.gz
move pkg/ioutils.HashData() to libnetwork/resolvconf
It's the only location it's used, so we might as well move it there. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Diffstat (limited to 'pkg/ioutils')
-rw-r--r--pkg/ioutils/readers.go11
-rw-r--r--pkg/ioutils/readers_test.go12
2 files changed, 0 insertions, 23 deletions
diff --git a/pkg/ioutils/readers.go b/pkg/ioutils/readers.go
index 1f657bd3dc..49d6936b14 100644
--- a/pkg/ioutils/readers.go
+++ b/pkg/ioutils/readers.go
@@ -2,8 +2,6 @@ package ioutils // import "github.com/docker/docker/pkg/ioutils"
import (
"context"
- "crypto/sha256"
- "encoding/hex"
"io"
)
@@ -49,15 +47,6 @@ func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader {
}
}
-// HashData returns the sha256 sum of src.
-func HashData(src io.Reader) (string, error) {
- h := sha256.New()
- if _, err := io.Copy(h, src); err != nil {
- return "", err
- }
- return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil
-}
-
// OnEOFReader wraps an io.ReadCloser and a function
// the function will run at the end of file or close the file.
type OnEOFReader struct {
diff --git a/pkg/ioutils/readers_test.go b/pkg/ioutils/readers_test.go
index 949e28739f..15f858aceb 100644
--- a/pkg/ioutils/readers_test.go
+++ b/pkg/ioutils/readers_test.go
@@ -58,18 +58,6 @@ func TestReaderErrWrapperRead(t *testing.T) {
}
}
-func TestHashData(t *testing.T) {
- reader := strings.NewReader("hash-me")
- actual, err := HashData(reader)
- if err != nil {
- t.Fatal(err)
- }
- expected := "sha256:4d11186aed035cc624d553e10db358492c84a7cd6b9670d92123c144930450aa"
- if actual != expected {
- t.Fatalf("Expecting %s, got %s", expected, actual)
- }
-}
-
type perpetualReader struct{}
func (p *perpetualReader) Read(buf []byte) (n int, err error) {