β οΈ This post links to an external website. β οΈ
Nearly six years ago I wrote a blog post outlining how I write HTTP services in Go, and Iβm here to tell you, once again, how I write HTTP services.
That original post went a little viral and sparked some great discussions that have influenced how I do things today. And after years of hosting the Go Time podcast, discussing Go on X/Twitter, and gaining more experience maintaining code like this over years, I thought it was time for a refresh.
(And for those pedants who notice Go isnβt exactly 13 years old, I started writing HTTP services in Go version .r59.)
This post covers a range of topics related to building services in Go, including:
- Structuring servers and handlers for maximum maintainability
- Tips and tricks for optimizing for a quick startup and graceful shutdown
- How to handle common work that applies to many types of requests
- Going deep on properly testing your services
From small projects to large, these practices have stood the test of time for me, and I hope they will for you too.
continue reading on grafana.com
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.