mirror of https://github.com/docker/docs.git
[MISC 1/4] Tiny refactor
Reduce function "snapshotExpired" in a simpler form and replace the literal string by the constants defined in the data package. Signed-off-by: Hu Keping <hukeping@huawei.com>
This commit is contained in:
parent
2f61b0a445
commit
6cd6b4726c
|
@ -97,11 +97,7 @@ func timestampExpired(ts *data.SignedTimestamp) bool {
|
|||
func snapshotExpired(ts *data.SignedTimestamp, snapshot []byte) bool {
|
||||
// If this check failed, it means the current snapshot was not exactly what we expect
|
||||
// via the timestamp. So we can consider it to be "expired."
|
||||
if err := data.CheckHashes(snapshot, ts.Signed.Meta["snapshot"].Hashes); err != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
return data.CheckHashes(snapshot, ts.Signed.Meta[data.CanonicalSnapshotRole].Hashes) != nil
|
||||
}
|
||||
|
||||
// CreateTimestamp creates a new timestamp. If a prev timestamp is provided, it
|
||||
|
|
Loading…
Reference in New Issue