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

Use make instead of new

This commit is contained in:
Guillaume J. Charmes 2013-05-08 10:35:41 -07:00
parent 7b1ec9ff30
commit c4ebf870c8

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