mirror of
https://github.com/docker/docs.git
synced 2026-04-12 06:19:22 +07:00
[MISC 4/4] distinguish nil and empty map
Since the function len(X) will return 0 no matter X is nil or an empty map. We should distinguish that. Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
@@ -453,7 +453,7 @@ func (c *Client) downloadSigned(role string, size int64, expectedHashes data.Has
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
if len(expectedHashes) != 0 {
|
||||
if expectedHashes != nil {
|
||||
if err := data.CheckHashes(raw, expectedHashes); err != nil {
|
||||
return nil, nil, ErrChecksumMismatch{role: role}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user