Skip to content

deprecate panicking functions#25

Open
ludusrusso wants to merge 1 commit into
VirusTotal:masterfrom
ludusrusso:24-fix-dont-panic
Open

deprecate panicking functions#25
ludusrusso wants to merge 1 commit into
VirusTotal:masterfrom
ludusrusso:24-fix-dont-panic

Conversation

@ludusrusso

Copy link
Copy Markdown

This PR solves #24

If you are ok with my proposal I can updates internal code and example to use the new function

Comment thread object.go Outdated
}

// MustGetInt64 is like GetInt64, but it panic in case of error.
// Deprecated: use GetInt64 instead

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't deprecate these functions. Similar to regexp.MustCompile for example.
https://www.journal.petrausch.info/post/2020/05/must-pattern/

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 {

@joseotoro joseotoro left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants