Fix: Commit and Built show unknown in the version info; go build fails on fresh checkouts#253
Open
Vikramarjuna wants to merge 1 commit intoCloud-Foundations:masterfrom
Open
Fix: Commit and Built show unknown in the version info; go build fails on fresh checkouts#253Vikramarjuna wants to merge 1 commit intoCloud-Foundations:masterfrom
Vikramarjuna wants to merge 1 commit intoCloud-Foundations:masterfrom
Conversation
b4a436b to
62219d1
Compare
rgooch
requested changes
May 3, 2026
| @@ -0,0 +1,7 @@ | |||
| version=unknown | |||
Member
There was a problem hiding this comment.
Please find a way to do this without including a default file.
Contributor
Author
There was a problem hiding this comment.
Removed the default Build info file which was introduced to support running go build without running make even once. Developers are expected to run make once, at least.
rgooch
reviewed
May 5, 2026
| revision: "unknown", | ||
| buildTime: "unknown", | ||
| } | ||
| buildInfo, ok := debug.ReadBuildInfo() |
Member
There was a problem hiding this comment.
Looking at what the compiler provides, it seems they've already done a lot of the work. Do we really need to re-invent this? Are we convinced that they haven't made good choices?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix:
CommitandBuiltshowunknown;go buildfails on fresh checkoutsTwo related issues with the embedded build info.
Problem 1 — Workspace builds lose VCS stamping
<binary> -versionshowedCommit: unknown,Built: unknownwhen the repo was built inside a Go workspace.Sample log:
Startup: v0.13.0-8-g392198aa (commit: unknown, origin: rgooch/Dominator, behind: up to date, built: unknown, go: go1.26.2)Cause:
lib/versionreadsvcs.revision,vcs.time, andvcs.modifiedfromruntime/debug.ReadBuildInfo(). Go suppresses allvcs.*settings in workspace mode, so those fields came back blank.Fix: write
commit,buildtime, anddirtyintoBUILD_INFOfrom theMakefile(using HEAD's commit time so the existingcmp -sno-op-rebuild optimization still holds).lib/versionreads them from there and falls back todebug.ReadBuildInfo()only when no realBUILD_INFOis embedded.