release: fix version ldflags package path#33
Merged
Conversation
The ldflags reference github.com/ustclug/rsync-proxy/pkg/info.Version, but the version variables actually live in the cmd package (github.com/ustclug/rsync-proxy/cmd.Version). The Go linker silently ignores -X flags for unresolved symbols, so v0.1.4 binaries report Version=0.0.0, GitCommit=$Format:%H$, BuildDate=1970-01-01T00:00:00Z. Update the package path to match Makefile and the actual variable definitions in cmd/cmd.go.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the ldflags path in the GoReleaser config to point to the new location of the version variables (cmd package instead of pkg/info).
Changes:
- Updates
-Xldflag paths frompkg/infotocmdpackage for Version, BuildDate, and GitCommit variables.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
Author
|
Added regression tests in
Verified by temporarily flipping the constant to the old |
Member
|
这里的测试我感觉是没有必要的? |
Contributor
Author
那就简单点只改 .goreleaser.yml |
Member
嗯 |
49139e5 to
d4ccfc9
Compare
taoky
approved these changes
May 28, 2026
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.
Summary
The
.goreleaser.ymlldflags line targetsgithub.com/ustclug/rsync-proxy/pkg/info.{Version,BuildDate,GitCommit}, but no such package exists. The actual variables live in thecmdpackage (cmd/cmd.go):Go's linker silently ignores
-Xfor unresolved symbols, so the released binary keeps the source defaults.Reproduction
The
v0.1.4release binary:Fix
Update the package path in
.goreleaser.ymlto match the variable locations and the existingMakefile(which usesgithub.com/ustclug/rsync-proxy/cmd.Version).Verification
Local build with the corrected ldflags reports the injected values correctly.