News for hackers. Stuff that matters.
Re:Graceful Shutdown in Go: Practical Patterns by eberkund on Monday May 05, 2025 @02:59AM (#43892554)
I created a small library for handling graceful shutdowns in my projects: https://github.com/eberkund/graceful

I find that I typically have a few services that I need to start-up and sometimes they have different mechanisms for start-up and shutdown. Sometimes you need to instantiate an object first, sometimes you have a context you want to cancel, other times you have a "Stop" method to call.

I designed the library to help my consolidate this all in one place with a unified API.

Re:Graceful Shutdown in Go: Practical Patterns by mariusor on Monday May 05, 2025 @04:04AM (#43892837)
Haha, I had the exact same idea, though my API looks a bit less elegant. Maybe it's because it allows the caller to set-up multiple signals to handle and in which way to do it.

https://pkg.go.dev/git.sr.ht/~mariusor/wrapper#example-Regis...

Re:Graceful Shutdown in Go: Practical Patterns by pseidemann on Monday May 05, 2025 @05:33AM (#43893266)
I did something similar as well: https://github.com/pseidemann/finish