Standard Search
About 18 results
https://rednafi.com/go/closure-mutable-refs/ · 25 Apr 2026
A Go closure holds a live reference to whatever it captures, not a snapshot. Real examples of where this trips people up, and how to keep it boring.
https://rednafi.com/go/mutex-closure/ · 5 Mar 2026
Why your mutex wrapper should accept a closure for mutation instead of a plain value, with examples from the standard library and Tailscale.
https://rednafi.com/go/context-cancellation-cause/ · 24 Feb 2026
How Go 1.20's WithCancelCause and Go 1.21's WithTimeoutCause let you attach a reason to context cancellation, plus a gotcha with manual cancel and the stdlib pattern that covers every path.
https://rednafi.com/go/structured-concurrency/ · 21 Feb 2026
How Python and Kotlin provide structured concurrency out of the box while Go achieves the same patterns explicitly using errgroup, WaitGroup, and context.
https://luminary.blog/techs/04-single-flight-pattern · 5 Nov 2025
How the single-flight pattern can prevent race conditions
https://rednafi.com/go/early-return-and-goroutine-leak/ · 7 Sep 2025
Prevent goroutine leaks caused by early returns with unbuffered channels. Learn buffering, draining, errgroup patterns, and goleak testing.
https://rednafi.com/go/prevent-struct-copies/ · 21 Apr 2025
Prevent dangerous struct copies with noCopy sentinel and go vet's copylock checker. Protect mutexes and sync primitives from value copies.
https://octet-stream.net/b/scb/watch-channel-in-go.html · 8 Nov 2024
8 November 2024 In this post I want to share a design pattern for a simple broadcast/watch channel in Go. I'm a relative golang newcomer and I've been learning how to do certain things that I already have a solution for in Rust—in this case tokio's wat...
https://rednafi.com/go/limit-goroutines-with-buffered-channels/ · 23 Aug 2023
Control goroutine concurrency with buffered channels as semaphores. Prevent resource exhaustion with backpressure patterns in Go workers.
https://rednafi.com/python/multithreaded-socket-server-signal-handling/ · 26 Feb 2023
Gracefully shutdown Python's ThreadingTCPServer with signal handlers for SIGINT, SIGTERM handling and client notification on server shutdown.