1
0
mirror of https://github.com/docker/cli.git synced 2026-01-15 07:40:57 +03:00

Use make instead of new

Upstream-commit: c4ebf870c8a9cef909e66fb517e607896ea8a518
Component: engine
This commit is contained in:
Guillaume J. Charmes
2013-05-08 10:35:41 -07:00
parent 2c41182b97
commit 9dcac35c2d

View File

@@ -267,13 +267,13 @@ func (img *Image) Checksum() (string, error) {
}
checksumDictPth := path.Join(root, "..", "..", "checksums")
checksums := new(map[string]string)
checksums := make(map[string]string)
if checksumDict, err := ioutil.ReadFile(checksumDictPth); err == nil {
if err := json.Unmarshal(checksumDict, checksums); err != nil {
return "", err
}
if checksum, ok := (*checksums)[img.Id]; ok {
if checksum, ok := checksums[img.Id]; ok {
return checksum, nil
}
}
@@ -304,10 +304,8 @@ func (img *Image) Checksum() (string, error) {
}
hash := "sha256:" + hex.EncodeToString(h.Sum(nil))
if *checksums == nil {
*checksums = map[string]string{}
}
(*checksums)[img.Id] = hash
checksums[img.Id] = hash
checksumJson, err := json.Marshal(checksums)
if err != nil {
return hash, err