Go Time: Golang, Software Engineering

How Mat writes HTTP services in Go

Jul 9, 2024
Mat Ryer, with 13 years of experience, shares insights on writing HTTP services in Go. Topics include project approach evolution, optimizing HTTP service routes, error handling, testing practices, and playful banter about 'good cop' and 'bad cop'.
Ask episode
AI Snips
Chapters
Transcript
Episode notes
ADVICE

http.Handler vs. http.HandlerFunc

  • Prefer using http.Handler for simpler type handling and easier integration with third-party libraries.
  • Consider long argument lists in constructors for explicit dependency management, but functional options are a valid alternative.
ANECDOTE

Airport Encounter

  • Mat Ryer met Tom Wilkie, CTO of Grafana, at an airport after a missed connection.
  • This encounter led to a discussion about Go and eventually to Mat's current job at Grafana Labs.
ADVICE

Functional Options Pattern

  • Use functional options pattern for constructor arguments to specify only necessary overrides.
  • This approach increases readability by focusing on non-default configurations, according to Johnny Boursiquot.
Get the Snipd Podcast app to discover more snips from this episode
Get the app