From 05df6d4f6232be5cf5586f2e89d053ec582eeec6 Mon Sep 17 00:00:00 2001 From: Antoine Eiche Date: Tue, 17 Jul 2018 15:19:26 +0200 Subject: goBuildPackage: Add -x to the go build command if NIX_DEBUG >= 1 The -x go option prints all intermediate commands used by the Go compiler. For instance, this is pretty useful to debug Go LD_FLAGS because the used linker command is printed. --- pkgs/development/go-modules/generic/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index bd047da4c919..621ab1f18f9f 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -151,6 +151,10 @@ go.stdenv.mkDerivation ( fi } + if (( "''${NIX_DEBUG:-0}" >= 1 )); then + buildFlagsArray+=(-x) + fi + if [ ''${#buildFlagsArray[@]} -ne 0 ]; then declare -p buildFlagsArray > $TMPDIR/buildFlagsArray else -- cgit 1.4.1