return error when io.Copy fails in Digest

Signed-off-by: 's avatarTariq Ibrahim <tariq181290@gmail.com>
parent 9fb19967
......@@ -405,7 +405,7 @@ func DigestFile(filename string) (string, error) {
func Digest(in io.Reader) (string, error) {
hash := crypto.SHA256.New()
if _, err := io.Copy(hash, in); err != nil {
return "", nil
return "", err
}
return hex.EncodeToString(hash.Sum(nil)), nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment