Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/time: move zoneinfo.zip to src/time/tzdata #46759

Closed
FiloSottile opened this issue Jun 15, 2021 · 8 comments
Closed

lib/time: move zoneinfo.zip to src/time/tzdata #46759

FiloSottile opened this issue Jun 15, 2021 · 8 comments
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone

Comments

@FiloSottile
Copy link
Contributor

I remember as a newcomer to be pretty confused by the top-level lib/ folder that didn't contain any library code. In the many years since, nothing but lib/time has been added to lib/.

As far as I understand, zoneinfo.zip exists so that if the GOROOT is available when the binary actually runs, time.LoadLocation will load it as the final fallback after checking system paths. (Relying on GOROOT at execution time is questionable, but not the point of this issue.)

When I mailed https://golang.org/cl/198062 there wasn't a clear place to move zoneinfo.zip, but after #38017 I think src/time/tzdata/ would be a natural place for it: if time/tzdata is imported, it gets embedded, and otherwise it will be searched under GOROOT as a fallback.

@FiloSottile FiloSottile added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 15, 2021
@FiloSottile FiloSottile added this to the Go1.18 milestone Jun 15, 2021
@gopherbot
Copy link
Contributor

Change https://golang.org/cl/198062 mentions this issue: lib/time: move to src/time/tzdata

@dmitshur
Copy link
Contributor

Also see #43350.

@ianlancetaylor
Copy link
Contributor

I would not be surprised if moving these files breaks some people who trim their GOROOT. Of course, we may want to do it anyhow.

@FiloSottile
Copy link
Contributor Author

Should Go 1.18 look in both $GOROOT/src/time/tzdata and $GOROOT/lib/time, or only the former? Do we want to support newer Go binaries running with an older GOROOT?

@ianlancetaylor
Copy link
Contributor

My concern isn't that we should support an older GOROOT, it's that some people will install Go and then delete parts of GOROOT that they don't need. I don't know how likely this is.

@dmitshur dmitshur added the early-in-cycle A change that should be done early in the 3 month dev cycle. label Jul 15, 2021
@dmitshur
Copy link
Contributor

dmitshur commented Jul 15, 2021

Added early-in-cycle so this issue gets a reminder when the tree reopens. If we're going to do this, doing it earlier gives the greatest opportunity to find out what needs updating (outside of the Go project) and reverse course if we find out disruption is too significant. Based on information available in this issue so far, to me this change seems worth trying.

To reduce the risk of this contributing to a delay in the release schedule (CC @golang/release), it's possible to create and maintain (throughout the 1.18 cycle) a revert CL, to make it faster and safer to undo at any point before the final release, if case significant new findings come in very late in cycle.

CC @rsc as owner of package time, since this file is an internal component related to it.

@cagedmantis
Copy link
Contributor

This issue is currently labeled as early-in-cycle for Go 1.18.
That time is now, so this is a friendly ping so the issue is looked at again.

@dmitshur dmitshur removed the early-in-cycle A change that should be done early in the 3 month dev cycle. label Aug 12, 2021
@rsc
Copy link
Contributor

rsc commented Aug 13, 2021

Let's not make any changes here.

People have no doubt configured stripped-down execution environments that provide a $GOROOT containing only a lib/time directory, and there is no point in forcing them to update those scripts - which are working and probably long-forgotten - by changing the location of the timezone database.

Historically, on Unix systems, lib directories often contained general reference files besides compiled libraries - look in /usr/lib on a Linux system, and note that two of the other hard-coded locations are /usr/share/lib/zoneinfo/ and /usr/lib/locale/TZ/. It turned out that nothing else ended up in GOROOT/lib, but that's OK.

If we were starting over, then sure, src/time/tzdata might be a reasonable location. But so is the current location, and the churn and breakage required to change it is not worth the (almost zero) benefit.

As Brad said on the CL, adding a lib/README.md would be fine.

@rsc rsc closed this as completed Aug 13, 2021
@golang golang locked and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
None yet
Development

No branches or pull requests

6 participants