From b66dea4711ab7dcb6352aae09e292bfa993015de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Mon, 6 Nov 2023 15:33:09 +0100 Subject: [PATCH] govulncheck: fix version information --- pkgs/tools/security/govulncheck/default.nix | 9 +++++++++ pkgs/tools/security/govulncheck/version.patch | 15 +++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 pkgs/tools/security/govulncheck/version.patch diff --git a/pkgs/tools/security/govulncheck/default.nix b/pkgs/tools/security/govulncheck/default.nix index 61249d354df1..1b7ee6cf015d 100644 --- a/pkgs/tools/security/govulncheck/default.nix +++ b/pkgs/tools/security/govulncheck/default.nix @@ -1,6 +1,7 @@ { lib , buildGoModule , fetchFromGitHub +, substituteAll }: buildGoModule rec { @@ -14,6 +15,14 @@ buildGoModule rec { hash = "sha256-cewQ03dK/k3mXevE09M01Yox/3ZWP6IrG0H4QsZMzy8="; }; + patches = [ + # patch in version information + (substituteAll { + src = ./version.patch; + inherit version; + }) + ]; + vendorHash = "sha256-r9XshbgVA5rppJF46SFYPad344ZHMLWTHTnL6vbIFH8="; subPackages = [ diff --git a/pkgs/tools/security/govulncheck/version.patch b/pkgs/tools/security/govulncheck/version.patch new file mode 100644 index 000000000000..2a79276fa15a --- /dev/null +++ b/pkgs/tools/security/govulncheck/version.patch @@ -0,0 +1,15 @@ +diff --git a/internal/scan/run.go b/internal/scan/run.go +index fa7fe37..216ca43 100644 +--- a/internal/scan/run.go ++++ b/internal/scan/run.go +@@ -99,8 +99,8 @@ func scannerVersion(cfg *config, bi *debug.BuildInfo) { + if bi.Path != "" { + cfg.ScannerName = path.Base(bi.Path) + } +- if bi.Main.Version != "" && bi.Main.Version != "(devel)" { +- cfg.ScannerVersion = bi.Main.Version ++ if true { ++ cfg.ScannerVersion = "@version@" + return + } +