DEV Community 👩‍💻👨‍💻

Discussion on: Use cases for persistent logs with NATS Streaming

Collapse
 
byronruth profile image
Byron Ruth Author

Good catch and thanks for letting me know! I do know this but I seem to let that bad habit creep in for examples and such. But here it is a bigger issue because properly closing connections is very important. I will update the examples shortly!

Collapse
 
byronruth profile image
Byron Ruth Author • Edited on

I guess I didn't realize this is a bit of a pain to do. Not terrible, but easy to miss. Basically only main should call Fatal or os.Exit and no defers should be used. More generally as long as no function in the stack above this call should use a deferred function.

Edit