feat(dirty-content-fingerprint): go_build injects fingerprint via ldflags
go_build now reads XCE_DIRTY_FINGERPRINT (empty-safe) and appends -X main.DirtyFingerprint=... to its existing -ldflags construction, falling back to plain empty string when unset -- deliberately NOT the "unknown" fallback GitCommit/BuildTime use, matching dirty_fingerprint's empty-means-nothing-to-show convention everywhere else in this feature. Existing GitCommit/BuildTime fallback logic is completely untouched. Verified independently by review with real scratch Go builds traced via bash -x: unset -> empty flag value (not fabricated); set -> exact value carried through; all-unset -> GitCommit/BuildTime still fall back to "unknown" while DirtyFingerprint stays empty, confirming the two conventions coexist without interference. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
d3d9522f27
commit
b949949367
2 changed files with 9 additions and 4 deletions
|
|
@ -101,6 +101,7 @@ export GOPROXY=https://goproxy.cn
|
|||
|
||||
_git_commit="$XCE_GIT_COMMIT"
|
||||
_build_time="$XCE_BUILD_TIME"
|
||||
_dirty_fingerprint="$XCE_DIRTY_FINGERPRINT"
|
||||
|
||||
if [ -z "$_git_commit" ]; then
|
||||
_git_commit=unknown
|
||||
|
|
@ -110,4 +111,8 @@ if [ -z "$_build_time" ]; then
|
|||
_build_time=unknown
|
||||
fi
|
||||
|
||||
(cd $_sdir; go build -gcflags "all=-N -l" -ldflags "-X main.GitCommit=$_git_commit -X main.BuildTime=$_build_time" -o "$_dfile" "$_sfile")
|
||||
if [ -z "$_dirty_fingerprint" ]; then
|
||||
_dirty_fingerprint=""
|
||||
fi
|
||||
|
||||
(cd $_sdir; go build -gcflags "all=-N -l" -ldflags "-X main.GitCommit=$_git_commit -X main.BuildTime=$_build_time -X main.DirtyFingerprint=$_dirty_fingerprint" -o "$_dfile" "$_sfile")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue