Skip to content

time: LoadLocation: ZONEINFO variable without effect on Windows #14276

@geoko86

Description

@geoko86

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:

  1. 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)
  2. 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

  1. Copy zoneinfo.zip from $GOROOT\lib\time\ to another location. E.g. C:\zoneinfo.zip
  2. Set ZONEINFO environment variable to point to previously copied zoneinfo E.g. set ZONEINFO=C:\zoneinfo.zip
  3. Move or delete your $GOROOT directory, so that it cannot be found anymore.
  4. 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions