Did I break a taboo by doing this?
There is! See “Errors are values” from the Go blog: https://go.dev/blog/errors-are-values
I would rename Check to Must which there is at least some precedent for.
Oh yeah and it's also less to type. Good idea!
Edit: here's the change https://github.com/danhab99/idk/blob/main/idk.go#L13
I would call it a taboo because it diverges from the general best practice. That makes your code harder to read and understand for people less familiar with "your style". Given that code is read much more often that it is written, you are optimizing on the wrong end.
I too consider that
if err != nil
a bit complicated to type. Most times, I wrap it away in a function like yourCheck0
. I know that the major "framework" for command line applications (cobra) has a similar logic with itscheckError
function.