Remove CheckSum from utils; replace with a TeeReader

Docker-DCO-1.1-Signed-off-by: Erik Hollensbe <github@hollensbe.org> (github: erikh)
This commit is contained in:
Erik Hollensbe
2014-07-30 11:23:43 -07:00
parent c18b38f912
commit ef6b78f7db
2 changed files with 3 additions and 26 deletions
-24
View File
@@ -1,24 +0,0 @@
package utils
import (
"encoding/hex"
"hash"
"io"
)
type CheckSum struct {
io.Reader
Hash hash.Hash
}
func (cs *CheckSum) Read(buf []byte) (int, error) {
n, err := cs.Reader.Read(buf)
if err == nil {
cs.Hash.Write(buf[:n])
}
return n, err
}
func (cs *CheckSum) Sum() string {
return hex.EncodeToString(cs.Hash.Sum(nil))
}