From 9bde9b4d1561ed915904a4f64764076dcfe58419 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Domas=20Tama=C5=A1auskas?= Date: Thu, 10 Oct 2019 21:54:18 +0300 Subject: [PATCH] time: document an alternative way of setting the system's time zone User's program was mutating time.Local variable and crashing itself as a consequence. Instead of documenting that time.Local variable should not be mutated, recommended way of setting the system's time zone has been documented. Fixes #34814 Change-Id: I7781189855c3bf2ea979dfa07f86c283eed27091 Reviewed-on: https://go-review.googlesource.com/c/go/+/200457 Reviewed-by: Ian Lance Taylor --- src/time/zoneinfo.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/time/zoneinfo.go b/src/time/zoneinfo.go index e6cac620fb..558803f24e 100644 --- a/src/time/zoneinfo.go +++ b/src/time/zoneinfo.go @@ -65,6 +65,11 @@ var UTC *Location = &utcLoc var utcLoc = Location{name: "UTC"} // Local represents the system's local time zone. +// On Unix systems, Local consults the TZ environment +// variable to find the time zone to use. No TZ means +// use the system default /etc/localtime. +// TZ="" means use UTC. +// TZ="foo" means use file foo in the system timezone directory. var Local *Location = &localLoc // localLoc is separate so that initLocal can initialize -- 2.50.0