health checker
The course project: a Go command-line tool that checks a list of targets concurrently and reports each one as healthy or not, as JSON.
In more detail
It reads typed configuration, runs one goroutine per target with a deadline, keeps each error beside its target, encodes the results as JSON on standard output and sets an exit code a pipeline or orchestrator can act on. It ships as a static binary in a minimal image.
Example
./healthcheck -timeout 2sRelated terms
- health check — A regular automated test of whether a program or service is working, such as a request to its health endpoint or a command run inside its container.
- goroutine — A function running concurrently with the rest of a Go program, started by putting the go keyword before a call.
- context deadline — A time limit attached to a context, after which it is cancelled automatically and ctx.Err() reports context.DeadlineExceeded.
- encoding/json — Go's standard library package for converting between Go values and JSON text.
- exit code — A number a process returns when it finishes: 0 means success, anything else means something went wrong.
Taught in
- Project Setup and Configuration — Concurrent Systems Programming with Go
- Executing Concurrent Checks — Concurrent Systems Programming with Go
- Handling Timeouts and Errors — Concurrent Systems Programming with Go
- Exporting Results as JSON — Concurrent Systems Programming with Go
- Containerizing and Testing the Final Build — Concurrent Systems Programming with Go