Skip to content

Commit 498ccd1

Browse files
authored
Merge pull request #946 from simonbrauner/remove-ioutils-hashdata
Remove unused ioutils.HashData
2 parents 5af159b + 1521cb5 commit 498ccd1

2 files changed

Lines changed: 0 additions & 23 deletions

File tree

storage/pkg/ioutils/readers.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ package ioutils
22

33
import (
44
"context"
5-
"crypto/sha256"
6-
"encoding/hex"
75
"io"
86
)
97

@@ -62,15 +60,6 @@ func NewReaderErrWrapper(r io.Reader, closer func()) io.Reader {
6260
}
6361
}
6462

65-
// HashData returns the sha256 sum of src.
66-
func HashData(src io.Reader) (string, error) {
67-
h := sha256.New()
68-
if _, err := io.Copy(h, src); err != nil {
69-
return "", err
70-
}
71-
return "sha256:" + hex.EncodeToString(h.Sum(nil)), nil
72-
}
73-
7463
// OnEOFReader wraps an io.ReadCloser and a function
7564
// the function will run at the end of file or close the file.
7665
type OnEOFReader struct {

storage/pkg/ioutils/readers_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,6 @@ func TestReaderErrWrapperRead(t *testing.T) {
5757
}
5858
}
5959

60-
func TestHashData(t *testing.T) {
61-
reader := strings.NewReader("hash-me")
62-
actual, err := HashData(reader)
63-
if err != nil {
64-
t.Fatal(err)
65-
}
66-
expected := "sha256:4d11186aed035cc624d553e10db358492c84a7cd6b9670d92123c144930450aa"
67-
if actual != expected {
68-
t.Fatalf("Expecting %s, got %s", expected, actual)
69-
}
70-
}
71-
7260
type perpetualReader struct{}
7361

7462
func (p *perpetualReader) Read(buf []byte) (n int, err error) {

0 commit comments

Comments
 (0)