Skip to content

About

Runnable example applications for github.com/ubgo/buildinfo — 11 examples covering basics, ldflags stamping, every HTTP framework adapter, OTEL, Zap, and slog.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

buildinfo-examples

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.

Quick start

git clone https://github.com/ubgo/buildinfo-examples.git
cd buildinfo-examples/01-basic
go run .

Learning path

Basics

  • 01-basic — auto-populated Info via runtime/debug.ReadBuildInfo.
  • 02-ldflags-stamping — CI-style version stamping with -ldflags (Makefile included).
  • 03-modules-list — dump dependency modules — SBOM-friendly.

HTTP framework adapters

Each example boots a tiny server and exposes /version. The shape of the API (Handler, Mount, WithPath, WithMiddleware) is uniform across all five frameworks.

Observability + logger adapters

Versioning

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.

Compatibility

Requires Go 1.24 or later.

License

Apache License 2.0. See LICENSE.

About

Runnable example applications for github.com/ubgo/buildinfo — 11 examples covering basics, ldflags stamping, every HTTP framework adapter, OTEL, Zap, and slog.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages