Skip to content

Adds comprehensive build versioning support to inject version information into all binaries at build time using ldflags#217

Open
Vikramarjuna wants to merge 5 commits intoCloud-Foundations:masterfrom
Vikramarjuna:versioning
Open

Adds comprehensive build versioning support to inject version information into all binaries at build time using ldflags#217
Vikramarjuna wants to merge 5 commits intoCloud-Foundations:masterfrom
Vikramarjuna:versioning

Conversation

@Vikramarjuna
Copy link

@Vikramarjuna Vikramarjuna commented Jan 29, 2026

Add Build Versioning Infrastructure

Add Version Information Support

Summary

Adds -version flag to all binaries using Go's embed package and VCS build info.

Changes

New Files:

  • lib/version/VERSION - Base version string
  • lib/version/version.go - Version package using embed + debug.ReadBuildInfo()

Modified Files:

  • lib/flags/loadflags/api.go - Register version flag
  • lib/flags/loadflags/impl.go - Version flag implementation

Version Format

  • v0.12.0+abc12345 - normal build
  • v0.12.0+abc12345-dirty - uncommitted changes

Usage

$ domtool -version
domtool v0.12.0+28a3a2c6
  Commit: 28a3a2c6
  Built:  2026-02-18T14:52:17Z
  Go:     go1.25.4

Note

  • Requires a release workflow to update lib/version/VERSION when creating new releases

Copy link
Member

@rgooch rgooch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like this PR to be split, with the first PR containing only the minimum to add version information (i.e. remove the workflow and reduce/eliminate changes to the Makefile).

I would prefer we don't impose a requirement to change every command. I think the lib/flags/loadflags package is a convenient place to make a fairly central change.

Finally, instead of injecting compile/link flags, I think it's better to use the embed package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants