deprecate panicking functions#25
Open
ludusrusso wants to merge 1 commit into
Open
Conversation
joseotoro
reviewed
Apr 28, 2022
| } | ||
|
|
||
| // MustGetInt64 is like GetInt64, but it panic in case of error. | ||
| // Deprecated: use GetInt64 instead |
Member
There was a problem hiding this comment.
I wouldn't deprecate these functions. Similar to regexp.MustCompile for example.
https://www.journal.petrausch.info/post/2020/05/must-pattern/
Author
There was a problem hiding this comment.
Didn't know this pattern, I like it in any case.
So what do you think about leave as is of Must* functions, deprecating URL function (it is not clear that can panic) and create a new MustURL function (or similar) to handle scenarios like
if _, err := s.cli.GetData(MustURL("monitor/items/upload_url"), &u); err != nil {
ludusrusso
force-pushed
the
24-fix-dont-panic
branch
from
April 28, 2022 14:09
393336f to
5e62f94
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR solves #24
If you are ok with my proposal I can updates internal code and example to use the new function