Skip to content
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

time: document the return value of time.Parse when parsing fails #23933

Closed
abbot opened this issue Feb 19, 2018 · 1 comment
Closed

time: document the return value of time.Parse when parsing fails #23933

abbot opened this issue Feb 19, 2018 · 1 comment

Comments

@abbot
Copy link

@abbot abbot commented Feb 19, 2018

Current implementation (as of this submission) of time.Parse always returns a zero time.Time{} value when it hits an error. It would be nice to document this and have it as a part of API, as it would simplify some use cases.

@ALTree ALTree changed the title Specify the return value of time.Parse when parsing fails time: document the return value of time.Parse when parsing fails Feb 19, 2018
@ALTree ALTree added this to the Go1.11 milestone Feb 19, 2018
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Feb 19, 2018

We aren't going to do that. While there are no plans to return a non-zero value, for an error case we only document the non-error result values where there is special reason to do so. There is no such reason here. You can write a trivial helper function to implement whatever functionality you want.

@golang golang locked and limited conversation to collaborators Feb 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.