1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

simplify image.Checksum

This commit is contained in:
shin- 2013-05-01 05:11:06 -07:00
parent 19045b530e
commit be791a223b

View file

@ -1,7 +1,6 @@
package docker
import (
"bytes"
"crypto/rand"
"crypto/sha256"
"encoding/hex"
@ -294,10 +293,10 @@ func (img *Image) Checksum() (string, error) {
}
h := sha256.New()
if _, err := io.Copy(h, bytes.NewBuffer(jsonData)); err != nil {
if _, err := h.Write(jsonData); err != nil {
return "", err
}
if _, err := io.Copy(h, strings.NewReader("\n")); err != nil {
if _, err := h.Write([]byte("\n")); err != nil {
return "", err
}
if _, err := io.Copy(h, layerData); err != nil {