From dd2afe681227be4b98f06cf603b11b310c440bef Mon Sep 17 00:00:00 2001 From: IndeedNotJames Date: Mon, 3 Apr 2023 21:11:54 +0200 Subject: [PATCH] gotestwaf: fix version self-reporting Note: Upstream uses `git describe --tags`, so we have to prefix the version string with the letter `v` just like we do in `src.rev` See https://github.com/wallarm/gotestwaf/blob/6905eb273c44e6f5c25d04ed4ae48ec4d89e7a96/Dockerfile#L50 --- pkgs/tools/security/gotestwaf/default.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/tools/security/gotestwaf/default.nix b/pkgs/tools/security/gotestwaf/default.nix index 7f16e07299fa..6ff958aa53d4 100644 --- a/pkgs/tools/security/gotestwaf/default.nix +++ b/pkgs/tools/security/gotestwaf/default.nix @@ -1,6 +1,8 @@ { lib , buildGoModule , fetchFromGitHub +, gotestwaf +, testers }: buildGoModule rec { @@ -19,11 +21,21 @@ buildGoModule rec { # Some tests require networking as of v0.4.0 doCheck = false; + ldflags = [ + "-X github.com/wallarm/gotestwaf/internal/version.Version=v${version}" + ]; + postFixup = '' # Rename binary mv $out/bin/cmd $out/bin/${pname} ''; + passthru.tests.version = testers.testVersion { + command = "gotestwaf --version"; + package = gotestwaf; + version = "v${version}"; + }; + meta = with lib; { description = "Tool for API and OWASP attack simulation"; homepage = "https://github.com/wallarm/gotestwaf";