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:
parent
19045b530e
commit
be791a223b
1 changed files with 2 additions and 3 deletions
5
image.go
5
image.go
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue