Skip to content

feat: add build info retrieval and associated tests#7

Merged
juancadev-io merged 1 commit intomainfrom
feat/fix-data-build
Mar 7, 2026
Merged

feat: add build info retrieval and associated tests#7
juancadev-io merged 1 commit intomainfrom
feat/fix-data-build

Conversation

@juancadev-io
Copy link
Contributor

This pull request introduces a new mechanism for automatically populating build metadata (version, commit, build date) from Go's embedded build info when running in development mode. It also adds corresponding tests to ensure this functionality works as expected and does not introduce regressions.

Build metadata population:

  • Added applyBuildInfo function in cmd/buildinfo.go to read Go's embedded build metadata and populate the version, commit, and buildDate variables when not injected via ldflags. This ensures accurate build information even when using go install or similar workflows.
  • Modified the package initialization logic to call applyBuildInfo automatically when version is set to "dev".

Testing improvements:

  • Added cmd/buildinfo_test.go with tests to verify that applyBuildInfo does not panic and does not incorrectly set the version to "(devel)". These tests help prevent regressions and ensure correct metadata handling.

@juancadev-io juancadev-io merged commit 8747665 into main Mar 7, 2026
2 checks passed
@github-actions github-actions bot mentioned this pull request Mar 7, 2026
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.

1 participant