xcaddy: fix build info

This commit is contained in:
IndeedNotJames 2023-02-07 15:58:25 +01:00
parent ed903ee4ef
commit 897bc4daab
No known key found for this signature in database
GPG key ID: 0AD773CE46FD0F87
2 changed files with 23 additions and 0 deletions

View file

@ -14,9 +14,16 @@ buildGoModule rec {
};
patches = [
./inject_version_info.diff
./use_tmpdir_on_darwin.diff
];
ldflags = [
"-s"
"-w"
"-X github.com/caddyserver/xcaddy/cmd.customVersion=v${version}"
];
vendorHash = "sha256-RpbnoXyTrqGOI7DpgkO+J47P17T4QCVvM1CfS6kRO9Y=";
meta = with lib; {

View file

@ -0,0 +1,16 @@
diff --git a/cmd/main.go b/cmd/main.go
index ede7cd8..c553140 100644
--- a/cmd/main.go
+++ b/cmd/main.go
@@ -401,8 +401,11 @@ func splitWith(arg string) (module, version, replace string, err error) {
return
}
+var customVersion string
+
// xcaddyVersion returns a detailed version string, if available.
func xcaddyVersion() string {
+ return customVersion
mod := goModule()
ver := mod.Version
if mod.Sum != "" {