Skip to content

fix: embed timezone database via time/tzdata#476

Merged
mtojek merged 2 commits intomainfrom
fix/embed-tzdata-470
Feb 6, 2026
Merged

fix: embed timezone database via time/tzdata#476
mtojek merged 2 commits intomainfrom
fix/embed-tzdata-470

Conversation

@mtojek
Copy link
Member

@mtojek mtojek commented Feb 6, 2026

Adds _ "time/tzdata" import to main.go so time.LoadLocation works in containers without system tzdata (e.g. scratch/distroless images).

Also changes the integration test timezone from UTC to America/New_YorkUTC is hardcoded in Go and never hits LoadLocation, so it never caught this.

Fixes #470

Adds `_ "time/tzdata"` import to main.go so the provider binary
includes an embedded copy of the IANA Time Zone database. This
ensures timezone operations work correctly even when the host
system lacks tzdata (e.g. scratch/distroless Docker images).

Fixes #470
Changes the integration test for coder_workspace_preset scheduling from
timezone = "UTC" to timezone = "America/New_York". UTC is hardcoded in
Go and always works regardless of tzdata availability, so it never caught
the bug described in #470. Using a real IANA timezone like America/New_York
ensures the test exercises time.LoadLocation against the timezone database
and will fail in environments without system tzdata unless the time/tzdata
package is embedded in the binary.

Also removes the overzealous AST-based main_test.go that was added
previously.

Refs #470
@mtojek mtojek changed the title fix: embed timezone database via time/tzdata import fix: embed timezone database via time/tzdata Feb 6, 2026
@mtojek mtojek requested a review from johnstcn February 6, 2026 08:31
@mtojek mtojek marked this pull request as ready for review February 6, 2026 08:31
@mtojek mtojek merged commit ef9a6dd into main Feb 6, 2026
6 checks passed
@mtojek mtojek deleted the fix/embed-tzdata-470 branch February 6, 2026 08:38
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Terraform provider fails to validate timezones in minimal container environments

2 participants