Runnable example applications demonstrating every adapter and usage pattern of github.com/ubgo/buildinfo.
Each example is a self-contained Go module under its own subdirectory. Clone the repo, cd into any example, and run go run . to see the feature working end-to-end.
git clone https://github.com/ubgo/buildinfo-examples.git
cd buildinfo-examples/01-basic
go run .01-basic— auto-populatedInfoviaruntime/debug.ReadBuildInfo.02-ldflags-stamping— CI-style version stamping with-ldflags(Makefile included).03-modules-list— dump dependency modules — SBOM-friendly.
Each example boots a tiny server and exposes /version. The shape of the API (Handler, Mount, WithPath, WithMiddleware) is uniform across all five frameworks.
04-http-nethttp— stdlibnet/http.04b-http-gin— Gin + auth middleware example.04c-http-chi— Chi.04d-http-echo— Echo.04e-http-fiber— Fiber.
05-with-otel-resource— OpenTelemetry resource attributes.06-with-zap— Zap log fields and namespace.07-with-slog— stdliblog/slogAttrs and group.
Each example's go.mod pins specific upstream versions of ubgo/buildinfo and any contrib adapters it imports. When a new minor release of the lib lands, all examples are updated in one PR.
During pre-v1.0 development, examples use replace directives that point at sibling local clones of ubgo/buildinfo. After tagging, the replace directives are removed.
Requires Go 1.24 or later.
Apache License 2.0. See LICENSE.