You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling time.Unix() with env TZ=UTC and found the time.Time result had a non nil location.
What did you see happen?
Location is expected to be nil for UTC and this differs from all other handling of time values in the package. It cause some confusion + required comparison changes for testing. The dates are equivalent but in an inconsistent format.
What did you expect to see?
According to notes in time.go, I was expecting the location to be nil.
// loc specifies the Location that should be used to
// determine the minute, hour, month, day, and year
// that correspond to this Time.
// The nil location means UTC.
// All UTC times are represented with loc==nil, never loc==&utcLoc.
loc *Location
The Unix function should be using setLoc to set location.
The text was updated successfully, but these errors were encountered:
Go version
go version go1.22.0 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Calling
time.Unix()
with envTZ=UTC
and found thetime.Time
result had a non nil location.What did you see happen?
Location is expected to be nil for UTC and this differs from all other handling of time values in the package. It cause some confusion + required comparison changes for testing. The dates are equivalent but in an inconsistent format.
What did you expect to see?
According to notes in
time.go
, I was expecting the location to benil
.The
Unix
function should be usingsetLoc
to set location.The text was updated successfully, but these errors were encountered: