Support setting version string via ldflags#262
Open
p5 wants to merge 1 commit intocaddyserver:masterfrom
Open
Conversation
Member
|
Caddy itself also does this actually, we recently just merged a patch which adds a couple more variables to override some other bits like the binary name for the help stuff in the command etc. Could you match the variable names we used for that in Caddy in here? |
When xcaddy is built directly from source (e.g. distro packaging), Go's debug.ReadBuildInfo() reports the main module version as "(devel)" rather than the actual release version. The upstream build process works around this by building from a separate wrapper module that imports xcaddy as a versioned dependency, but packagers typically build directly from the source tarball. Add a CustomVersion variable that can be set via -ldflags -X at build time, allowing packagers to inject the correct version string.
87f4a99 to
127d8c9
Compare
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.
When xcaddy is built directly from source (e.g. distro packaging), Go's debug.ReadBuildInfo() reports the main module version as "(devel)" rather than the actual release version. The upstream build process works around this by building from a separate wrapper module that imports xcaddy as a versioned dependency, but packagers typically build directly from the source tarball.
Add a version variable that can be set via -ldflags -X at build time, allowing packagers to inject the correct version string.
Other Go projects also do similar: