Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

LastModifiedTime compare with .Equal instead of operator #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dctucker
Copy link

We're seeing more frequent failures when uploading, and this patch seems like it could help based on the error messages we're seeing.

Last modified time of the VHD file in
Azure blob storage (2019-08-12 16:38:18.823769424 +0000 UTC)
and local VHD file (2019-08-12 16:38:18.823769424 +0000 UTC) does not match

(line-breaks edited for clarity)

From https://golang.org/pkg/time/#Time

Note that the Go == operator compares not just the time instant but also the Location and the monotonic clock reading. Therefore, Time values should not be used as map or database keys without first guaranteeing that the identical Location has been set for all values, which can be achieved through use of the UTC or Local method, and that the monotonic clock reading has been stripped by setting t = t.Round(0). In general, prefer t.Equal(u) to t == u, since t.Equal uses the most accurate comparison available and correctly handles the case when only one of its arguments has a monotonic clock reading.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant