Skip to content

Latest commit

 

History

History
74 lines (49 loc) · 5.86 KB

File metadata and controls

74 lines (49 loc) · 5.86 KB

Changelog

All notable changes to this project are documented in this file.

The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.

Added

  • buildinfo-slog, buildinfo-zap, and buildinfo-otel now emit the build provenance added in 0.1.2: build_source (slog, zap) and build.source / KeySource (otel). These three adapters enumerate fields by hand, so a new core field reaches logs and traces only when they are updated — the failure mode is a silently missing key rather than a compile error, so each now has a test asserting the key is present and holds a valid buildinfo.Source. The HTTP adapters serialize via Info.JSON and picked the field up automatically.

Changed

  • All eight contrib/ adapters now require github.com/ubgo/buildinfo v0.1.2.

[0.1.2] - 2026-08-20

Added

  • Info.Source reports which input produced Info.Version: SourceLdflags (stamped by the release pipeline), SourceModule (resolved by go install pkg@version), or SourceUnknown (a plain go build / go run / go test). The version string alone is ambiguous — a binary reports dev both when built locally and when a release pipeline silently failed to pass its ldflags — and those need different responses. Source is assigned in the same statement as Version at every site, so the two cannot drift.
  • Source.Valid() and Source.String().
  • Info.HasVersion() reports whether Version came from a real input, equivalent to Source != SourceUnknown.
  • Info.HasCommit() reports whether Commit holds a real hash rather than the Unknown sentinel. Check it before rendering Modified: "unknown (dirty)" asserts a dirty checkout for a build that carries no VCS record at all.
  • Exported sentinels DevVersion ("dev") and Unknown ("unknown"). Consumers previously had to hardcode these literals or duplicate them as private constants, which breaks silently if this package ever changes one.
  • source key in Map() output and "source" field in Info.JSON().

Changed

  • The "dev" and "unknown" literals inside load() now reference the exported sentinel constants, so there is a single definition of each.
  • Package and Info documentation expanded: every field carries its own doc comment, and the package doc gains Provenance and Dependencies sections.

Added

  • release workflow supports workflow_dispatch with an existing tag, for tags pushed before the workflow existed or when a push-triggered run needs re-running. Deleting and re-pushing a tag is not an option once the module proxy has cached it. Note that GitHub does not trigger push-tag workflows when more than three tags arrive in one push — release tags must be pushed in batches of three or fewer, or dispatched manually.
  • release workflow: pushing a release tag runs that module's vet + race tests and, on success, creates the GitHub Release with notes taken from this file. Handles both tag shapes in this repo — vX.Y.Z for the core module and contrib/<adapter>/vX.Y.Z for adapters — deriving the module directory from the tag. Notes are passed via --notes-file and every value reaches the shell through env:, never through inline ${{ }} expansion, so backticks in CHANGELOG prose cannot be command-substituted into the release body. Only the core module quotes the root CHANGELOG; adapters share that file and their versions collide with core's, so they get generic notes. Re-running a tag updates its existing release rather than failing. There is no auto-bump-on-merge path: cutting a library version stays a deliberate act.

Changed

  • All eight contrib/ adapters now require github.com/ubgo/buildinfo v0.1.1, so consumers importing an adapter pick up the Main.Version fallback without an explicit go get -u of the core module.

[0.1.1] - 2026-08-20

Changed

  • Info.Version now falls back to runtime/debug.BuildInfo.Main.Version when no -ldflags override is set, so binaries installed via go install pkg@version report the resolved module version instead of the "dev" sentinel. The (devel) placeholder reported for locally built binaries is treated as absent, preserving the previous "dev" behaviour for go build / go run / go test. -ldflags overrides continue to win.

[0.1.0]

Added

  • Initial implementation of the buildinfo core module: Info, Module, Get, Map, Info.JSON.
  • -ldflags overrides for Version, Commit, BuildTime, Branch.
  • Auto-population of GoVersion, GOOS, GOARCH, Modified, Modules via runtime/debug.ReadBuildInfo.
  • Sentinel default values ("dev", "unknown") for empty fields.
  • Test suite with 100% statement coverage covering ldflags precedence, VCS fallback, replace-resolution, JSON round-trip, and Map shape.
  • Eight adapter modules under contrib/:
    • buildinfo-nethttp — stdlib net/http /version handler + Mount helper.
    • buildinfo-gin — Gin handler + Mount helper.
    • buildinfo-chi — Chi Mount helper using stdlib http.Handler.
    • buildinfo-echo — Echo handler + Mount helper.
    • buildinfo-fiber — Fiber handler + Mount helper.
    • buildinfo-otel — OpenTelemetry resource attributes via Attributes().
    • buildinfo-zap — Zap log fields via Fields() and Namespace().
    • buildinfo-slog — stdlib slog Attrs via Attrs() and Group().
  • Each adapter ships its own Go module with its own go.mod, so consumers only download dependencies of the adapters they import.
  • Every adapter exposes a uniform API: Handler, Mount(router, ...) with WithPath and WithMiddleware options for HTTP renderers; Fields/Attrs/Attributes for logging and observability adapters.
  • Taskfile, CI workflows, README, CONTRIBUTING, NOTICE.
  • Licensed under Apache License 2.0.