-
Task
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
None
-
None
-
False
-
-
False
-
None
-
None
-
None
-
None
When building the hypershift CLI from a git worktree, hypershift --version shows [unknown] instead of the git commit hash.
Root cause: Go's VCS stamping does not embed vcs.revision into binaries when building with -mod=vendor or from git worktrees. The GetRevision() function in support/supportedversion/version.go relies solely on runtime/debug.ReadBuildInfo() to retrieve the commit hash, which returns nothing in these scenarios.
Fix: Add a commitHash package variable to supportedversion that is injected via -ldflags -X at build time, and use it as a fallback in GetRevision() when debug.ReadBuildInfo() does not provide vcs.revision. The Makefile build recipes are updated to pass git rev-parse HEAD through ldflags.
Files changed:
- Makefile — added COMMIT_HASH, VERSION_PKG, GO_LDFLAGS variables; updated GO_BUILD_RECIPE and GO_CLI_RECIPE
- support/supportedversion/version.go — added commitHash variable and fallback logic in GetRevision()