Support file-backed TZ values - #2247
Open
fzlzjerry wants to merge 1 commit into
Open
Conversation
Load absolute TZif paths and normalize one optional leading colon while preserving invalid-zone diagnostics and mid-process timezone updates. Fixes johnkerl#1406.
johnkerl
approved these changes
Sep 9, 2026
johnkerl
left a comment
Owner
There was a problem hiding this comment.
Beautiful, thank you @fzlzjerry !
Owner
|
I'll take a look at the Windows-only CI fails. |
Author
|
Thanks, @johnkerl, for the review and for taking the Windows CI investigation. I’ll keep this branch focused on the file-backed TZ change; please let me know if the Windows investigation identifies a correction needed here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1406.
Allow
TZto name an absolute TZif file, with an optional leading colon, and accept colon-prefixed zone names. This applies at startup, through--tz, and when the DSL changesENV["TZ"].Keep the explicit validation rather than relying only on Go's cached
time.Local: invalid names/files still report the existing diagnostic, and timezone changes still take effect within a running process. Files are loaded throughtime.LoadLocationFromTZData, preserving transition rules, with the same 10 MiB file-size limit as Go's timezone loader. Explicit timezone arguments to individual functions remain name-based.The troubleshooting template and generated page now describe the supported file forms instead of the previous workaround. Unrelated generated date, platform, and numeric-output changes are not included.
Validation
make devcompletes: build, unit tests, all 4,796 CLI regression cases, man-page generation, and documentation generation/build.go vetpasses on Go 1.27.1.make lintwith the CI-pinned golangci-lint 2.12.2 reports 0 issues.TZ,--tz, runtime changes, normal CSV processing, invalid-value controls, symlinks, and winter/summer conversion using a real timezone file. The two changed functions have 100% statement coverage in the Go 1.26.8 test run.