You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loading ZoneInfo accesses disk which can fail for various reasons. The method time.loadZoneFile() does not expose these errors to time.LoadLocation(). Hence, it reports a generic "unknown time zone" error as an effect to such failures.
I think this is an issue because loadZoneFile is swallowing error details too much. The most common failure mode for any particular attempt in that function is to get a file not found, which is fine to suppress, but other kinds of errors should be reported back so that callers to time.LoadLocation can discover why it's failing.
Here's my proposal:
if loadZoneFile finds a file it can successfully load, it reports no error (current behaviour)
if no file can be loaded, and there's an error that does not satisfy os.IsNotExist, report that error (new behaviour)
if all the errors satisfy os.IsNotExist, report the generic message (current behaviour)
mikioh
changed the title
time.loadZoneFile() doesn't forward error returned while reading zoneinfo file.
time: loadZoneFile() doesn't forward error returned while reading zoneinfo file.
Jan 30, 2015
Loading ZoneInfo accesses disk which can fail for various reasons. The method time.loadZoneFile() does not expose these errors to time.LoadLocation(). Hence, it reports a generic "unknown time zone" error as an effect to such failures.
https://golang.org/src/time/zoneinfo_unix.go
@dsymonds: who is aware of this problem.
The text was updated successfully, but these errors were encountered: