Skip to content

Resolve version from debug.ReadBuildInfo for go install users#322

Merged
AndreyVMarkelov merged 1 commit into
masterfrom
feat/version-buildinfo
Jul 2, 2026
Merged

Resolve version from debug.ReadBuildInfo for go install users#322
AndreyVMarkelov merged 1 commit into
masterfrom
feat/version-buildinfo

Conversation

@AndreyVMarkelov

@AndreyVMarkelov AndreyVMarkelov commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • When version is not injected via -ldflags (e.g. go install), resolve it from debug.ReadBuildInfo() module version
  • Falls back to dev when build info is unavailable or shows (devel)
  • Injected ldflags version always takes priority

Test plan

  • go test ./... passes (4 new test cases cover all branches)
  • go build -o dbxcli . → version shows module pseudo-version
  • go build -ldflags "-X main.version=4.0.0" → version shows 4.0.0
  • Text and JSON output both correct

Users who install with `go install` get the module version automatically
instead of a hardcoded fallback.
@AndreyVMarkelov AndreyVMarkelov merged commit 2e3b9d3 into master Jul 2, 2026
9 checks passed
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