Sorry for having two features in one PR. The second feature requires the first one.
I have added a wrapper for simple HTTP GET's: HTTPGetString(url string) returns the HTTP GET response body as string and optionally an error.
That function is wrapped by MustHTTPGetString(url string), which doesnt return a second value (error), but instead panics when an error occurs. The panic is recovered at *Project.run(..) so it is nicely printed without stacktrace.
I think the Must* approach can be used for multiple other godo helper functions.
Sorry for having two features in one PR. The second feature requires the first one.
I have added a wrapper for simple HTTP GET's:
HTTPGetString(url string)
returns the HTTP GET response body as string and optionally an error. That function is wrapped byMustHTTPGetString(url string)
, which doesnt return a second value (error), but instead panics when an error occurs. The panic is recovered at*Project.run(..)
so it is nicely printed without stacktrace.I think the Must* approach can be used for multiple other godo helper functions.