go
Go services: concurrency, HTTP, and shipping a single binary.
-
A Rules File for Health Evaluation, Validated at Load Time
Hardcoding a threshold per metric works until you have more than a handful of them, and a hand-edited rules file that is only checked when a rule fires will eventually ship a typo straight into production. Here is a small Go health-evaluation engine that validates its entire rules file before it evaluates a single metric.
-
Merging Concurrent Polls Without Ever Serving a Half-Built Graph
A console that polls host inventory, storage, network and alerting concurrently must never show a reader a graph where some sources landed and others did not. This walks through why updating shared state field by field under a mutex fails silently, and how to publish a fully-built snapshot with a single atomic swap instead, with a runnable Go program and a race-tested invariant to prove it.
-
An Entity Graph as the Data Model for a Heterogeneous Estate
Hosts, volumes, links and alerts have genuinely different shapes, but an observability console still needs one model that can answer "what does this depend on" and "what is this node's health" without a type-specific code path for every kind of thing. This walks through an entity-graph model in Go that gets there, with a complete runnable implementation.
-
Designing a Docker Image Build API: Job Model and Streamed Logs
An HTTP endpoint that triggers a Docker image build cannot behave like a normal request/response call, because the build takes an unpredictable amount of time and a client needs to watch its output as it happens rather than poll for a final result. This article designs the job and streaming model for that, with a complete Go service built on the Docker SDK.
-
Embedding a Built Frontend Into a Go Binary with go:embed
Serving a single-page application from a separate static file server next to its API is two processes that have to be deployed and versioned together but usually are not. This article embeds a built frontend directly into the Go binary that also serves the API, with a complete example including the single-page-application routing fallback that this approach needs to get right.
-
A Minimal Go HTTP Service with chi, Timeouts and Graceful Shutdown
http.ListenAndServe has no default timeouts and no way to drain in-flight requests on SIGTERM, so a rolling deploy or a container orchestrator's stop signal cuts connections mid-response. This builds a small chi-based service with explicit server timeouts and a shutdown sequence that waits for in-flight work to finish, with a test that proves a slow request survives a shutdown signal instead of being killed by it.