-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: time: add enumeration for locations #36278
Comments
Please give some examples of what you would like to see. Thanks. As far as I can see the list of IANA timezone names is quite long and subject to regular change: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones . |
Does the location names change frequently? If that's the case I see the problem |
The timezone database updates frequently. To update timezone database the Go team can release it with each Go version or create a mechanism to update it with go get (better option I think) |
But why is |
Because of autocompletion. In first approach there will be compile time error and in the second one there will be error in run time |
The problem is that we read timezones data from the system database, and we support the timezones names and abbreviations we read from the system... So if, for example, we include And what happens if a name is removed from the DB? We can't remove it from the enum without breaking backward compatibility. |
My point is that it's probably not worth having compile-time checks (in the form of a fixed enum) on something that is gonna be dynamic anyway like timezones data (which is dynamic because as I wrote we read the data at runtime from the system database). |
Yes, you are right, there are tradeoffs in both side, I just added this issue for discussion, I wanted to know other people's opinion about what was better |
Since we get the timezone information from the local system, I agree that it would be unfortunate to define enum values for timezones that are not necessarily supported. |
I think it would be nice to have an enumeration for IANA Time Zone database names instead of strings
The text was updated successfully, but these errors were encountered: