From c4ebf870c8a9cef909e66fb517e607896ea8a518 Mon Sep 17 00:00:00 2001 From: "Guillaume J. Charmes" Date: Wed, 8 May 2013 10:35:41 -0700 Subject: [PATCH] Use make instead of new --- image.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/image.go b/image.go index bf86e2e7f7..5778931655 100644 --- a/image.go +++ b/image.go @@ -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