Skip to content

time: macOS creates invalid time.Locations using time.LoadLocation #21512

@mconbere

Description

@mconbere

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go1.8.3

What operating system and processor architecture are you using (go env)?

darwin, amd64

What did you do?

https://play.golang.org/p/zLXHSpuqye

This program on play.golang.org prints:

input: "America/New_York", output: "America/New_York", err: <nil>
input: "America/new_york", output: "UTC", err: cannot find America/new_york in zip file /usr/local/go/lib/time/zoneinfo.zip

On macOS 10.12.4 with a case insensitive HFS+ filesystem it prints:

input: "America/New_York", output: "America/New_York", err: <nil>
input: "America/new_york", output: "America/new_york", err: <nil>

What did you expect to see?

I expected an error to be returned when I ran time.LoadLocation("America/new_york"). These values should be treated as case sensitive. Also potentially valid would be for a valid location to be returned:

loc, _ := time.LoadLocation("America/new_york")
loc.String() == "America/New_York"

What did you see instead?

No error was returned, and a Location was returned with an invalid name. This causes valid zone names on macOS to fail to load on another machine using an identical zoneinfo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions