{"podcast":{"title":"Go Time: Golang, Software Engineering","slug":"go-time-golang-software-engineering","podcast_index_feed_id":218840,"rss_url":"https://changelog.com/gotime/feed","website_url":"https://changelog.com/gotime","image_url":"https://cdn.changelog.com/uploads/covers/go-time-original.png?v=63725770357","author":"Changelog Media","episode_count":347,"summary":"Your source for wide-ranging discussions from all around the Go community. Panelists include Mat Ryer, Jon Calhoun, Natalie Pistunovich, Johnny Boursiquot, Angelica Hill, Kris Brandow, and Ian Lopshire. We discuss cloud infrastructure, distributed systems, microservices, Kubernetes, Docker... oh and also Go! Some people search for GoTime or GoTimeFM and can't find the show, so now the strings GoTime and GoTimeFM are in our description too.","last_synced_at":null,"page_url":"https://stenobird.com/podcast/go-time-golang-software-engineering"},"episode":{"title":"How Mat writes HTTP services in Go","slug":"how-mat-writes-http-services-in-go","published_at":"2024-07-09T16:00:00+00:00","page_url":"https://stenobird.com/podcast/go-time-golang-software-engineering/how-mat-writes-http-services-in-go","show_page_url":"https://stenobird.com/podcast/go-time-golang-software-engineering","url":"https://changelog.com/gotime/322","audio_url":"https://op3.dev/e/https://cdn.changelog.com/uploads/gotime/322/go-time-322.mp3","summary":"Mat Ryer shares architectural lessons from 13 years of building HTTP services in Go. The discussion focuses on moving away from complex abstractions toward simpler, more testable, and readable code patterns.","meta_description":"Learn Mat Ryer's evolved approach to building robust, testable, and maintainable HTTP services in Go, focusing on simplicity and dependency management.","key_points":["Main idea: Prioritize the standard library's http.Handler interface over custom function types to improve compatibility with third-party libraries","Practical takeaway: Use a top-level context in a 'run' function to manage the lifecycle of goroutines and enable programmatic graceful shutdowns","Failure mode: Avoid injecting environment variables or global state directly into handlers; instead, pass dependencies through structs to ensure deterministic testing","Practical takeaway: Optimize code for readability and simplicity, as code is read far more often than it is written","Main idea: Treat the package as the primary unit of testing to maintain clear boundaries and service integrity"],"chapters":[{"start_ms":395000,"title":"Moving from custom types to http.Handler","summary":"Why Mat transitioned from using custom handler function types to the standard library's http.Handler to reduce glue code and improve interoperability."},{"start_ms":1030000,"title":"Managing dependencies and scale","summary":"How to structure dependencies like loggers and databases within structs to maintain clean APIs even as route counts grow into the hundreds."},{"start_ms":1665000,"title":"Deterministic testing with context","summary":"Using a main application context to manage goroutine lifecycles and enable parallel, self-contained tests without side effects."},{"start_ms":2005000,"title":"Graceful shutdowns and signal trapping","summary":"The importance of trapping interrupts and using context to ensure all background processes finish before the server exits."},{"start_ms":2665000,"title":"Error wrapping and package boundaries","summary":"A discussion on the risks of leaking HTTP-specific error details into lower-level packages and how to handle error wrapping effectively."},{"start_ms":3625000,"title":"The philosophy of readable code","summary":"Why the most 'boring' and simple code is often the best for long-term maintenance and team productivity."}],"topics":["Go programming","HTTP services","Software architecture","Unit testing","Dependency injection","Concurrency","Context pattern","Backend engineering"],"duration_seconds":4267,"processing_state":"processed","actions":[{"name":"request_transcript","method":"POST","url":"https://stenobird.com/v1/public/podcasts/go-time-golang-software-engineering/episodes/how-mat-writes-http-services-in-go/transcription-requests","description":"Idempotently request low-priority transcript generation for this episode."},{"name":"read_markdown","method":"GET","url":"https://stenobird.com/podcast/go-time-golang-software-engineering/how-mat-writes-http-services-in-go.md","description":"Read the agent-friendly Markdown representation of this episode resource."}]}}