53 karma · joined March 12, 2018
So I was out setting up custom error pages on Cloudflare. If you've used their service and have setup custom erorr pages, you know they require a URL where your template is hosted, and won't accept the HTML as is. And that's where my journey started, after searching around and trying to use some of the services, finally I hosted it as a Github page. For me it turned out to be a time consuming endeavour and I didn't think it was worth it, and thus HTMLHost.live!
You can find the source code at https://github.com/bnkamalesh/htmlhost/
- Multiple (11) error types
- User friendly message
- File & line number prefixed to errors
- HTTP status code and user friendly message (wrapped messages are concatenated) for all error types
In case of nested errors, the messages (in case of nesting with this package's error) & errors are also looped through. The limited no.of error types are only because I assumed too many options and too much customization might lead to some kind of fatigue. Tried making things a bit easier.
Oh, at whom?
So like the title says, it's an opinionated guideline to structure a Go web application/service (or could be extended for any application). And my opinions formed over a span of 5+ years building web applications/services with Go. Even though I've mentioned go.mod and go.sum, this guideline works for 1.4+ (i.e. since introduction of 'internal' special directory).