Don't return err in Go.
Instead, add missing details relevant for debugging.
More on that: http://akavel.com/go-errors
@akavel great post and beautiful blog!
I just wanted to add that personally, I've explained this as:
> Error messages should contain the word 'because'.
> Like 'can't do x because y happened'
IMO the important part you are commenting on your blog is that we need both the x and y information," because" is just an intuitive heuristic to remind about that
@akavel I was mostly coming from a usability angle w/ "because". Yes you are right the colon that golang puts in by default takes its place.
To give a more concrete example, instead of the error being "can't display user page" or "file '/opt/myapp/templates/user.tmpl' not found", ideally it would be
"can't display user page because file ''/opt/myapp/templates/user.tmpl' not found"
I suppose
"can't display user page: file ''/opt/myapp/templates/user.tmpl' not found"
is fine too but I prefer the former, I think in some situations it makes it more clear / easier to read. Especially for users who might not be experienced with golang and stuff