We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Attempting to use iferr on a function which returns a value of either time.Time or time.Duration results in attempting to return a nil value.
func returnTime() time.Time { if err != nil { return nil } } func returnDur() time.Duration { if err != nil { return nil } }
This is not correct, and will result in an error at compile time. What should instead be returned is this
func returnTime() time.Time { if err != nil { return time.Time{} } } func returnDur() time.Duration { if err != nil { return time.Duration(0) } }
The text was updated successfully, but these errors were encountered:
@comicsads This fork now supports time.Time and time.Duration, based on your suggestion, if it's any help.
time.Time
time.Duration
The forked is used in my little editor o to make it possible to just type iferr on a single line to expand it into an if err != nil ... block.
o
iferr
if err != nil ...
Thanks for creating this project, @koron. 👍
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Attempting to use iferr on a function which returns a value of either time.Time or time.Duration results in attempting to return a nil value.
This is not correct, and will result in an error at compile time. What should instead be returned is this
The text was updated successfully, but these errors were encountered: