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
When you try to execute time.LoadLocation() on Windows program panic unless it finds zoneinfo.zip file in $GOROOT/lib/time/zoneinfo.zip. Even with ZONEINFO environment variable set you get the same panic.
Take program from playground, and compile locally on windows. (Cross compiling will result in $GOROOT pointing to $GOROOT of the original Mac OS X machine)
Compile with go build and execute. Output should be something like this:
Found zoneinfo env: false, location: '' .
2009-11-11T07:00:00.0000+08:00
Copy zoneinfo.zip from $GOROOT\lib\time\ to another location. E.g. C:\zoneinfo.zip
Set ZONEINFO environment variable to point to previously copied zoneinfo E.g. set ZONEINFO=C:\zoneinfo.zip
Move or delete your $GOROOT directory, so that it cannot be found anymore.
Execute again
Expected output
Similar to output in step 2
Observed behavior
Program panics.
Found zoneinfo env: true, location: 'E:\zoneinfo.zip' .
open C:\Go\lib\time\zoneinfo.zip: The system cannot find the path specified.
panic: time: missing Location in call to Date
The text was updated successfully, but these errors were encountered:
geoko86
changed the title
time.LoadLocation: ZONEINFO variable without effect on Windows
time: LoadLocation: ZONEINFO variable without effect on Windows
Feb 9, 2016
@alexbrainman Thanks for checking.
It figured out what went wrong. I double checked the zoneinfo.zip that i was using and it turned out, that the copy was incomplete, only 105kB vs some 352kB.
When I copied it again and pointed ZONEINFO to it, it works.
The error message was not completely clear to me, would have expected something along the line "found zoneinfo.zip, but I cannot read it".
When you try to execute time.LoadLocation() on Windows program panic unless it finds zoneinfo.zip file in $GOROOT/lib/time/zoneinfo.zip. Even with ZONEINFO environment variable set you get the same panic.
Test program can be found here: http://play.golang.org/p/UgiIKSEiIP
Using golang 1.5.3 on Windows x86_64
Repro:
set ZONEINFO=C:\zoneinfo.zip
Expected output
Similar to output in step 2
Observed behavior
Program panics.
The text was updated successfully, but these errors were encountered: