Golang
Advanced Go Concurrency Patterns
Master goroutines, channels, and concurrency patterns for building high-performance Go applications
Go’s concurrency model is one of its most powerful features. This guide explores goroutines, channels, and advanced patterns for writing efficient concurrent code.
3 Ways to Add a --version Flag to a Go CLI
Inject build metadata with -ldflags, read it back with debug.ReadBuildInfo, or grab a tiny helper package — three approaches to a --version flag, with the trade-offs of each
Every CLI eventually grows a --version flag. Users need it to file useful bug reports, scripts need it to gate behavior, and you need it when an issue lands and you want to know what binary the reporter is actually running. Go gives you a few ways to wire this up — none of them long, but each with different ergonomics. Here are the three I reach for.
A Guide to Upgrading Your Library to a Major Release in Go
Practical walkthrough of bumping a Go module to v2+: import paths, branches, tags, and what not to forget.
Bumping a Go library to a new major version is not just a git tag v2.0.0. Go’s Semantic Import Versioning makes the module path itself part of the version contract — so v2+ means rewriting go.mod, every internal import, and (often) reorganizing branches. This is the short, command-driven version of the official guide, with the operational steps that are easy to forget.
Bootstrap Go Projects with gonew
Use the official gonew tool to scaffold new Go projects from a template repository — and a real-world example with template-api
Every Go service I start tends to need the same plumbing: a cmd/ entry point, a Dockerfile, a Taskfile, golangci-lint config, CI workflows, a release pipeline. Copy-pasting from the previous project works, but it gets stale fast. gonew — the official Go scaffolding tool — turns any module into a reusable starting point.
How Go Channels Work: The Behavior Matrix
A practical guide to Go channels — receive, send, and close behavior across nil, unbuffered, buffered, and closed states
Channels are Go’s primary tool for coordinating goroutines, but their behavior changes drastically depending on their state. A channel can be nil, unbuffered, buffered, or closed — and the same operation (send, receive, close) does something different in each case. Getting this matrix wrong is how deadlocks and panics happen.