From 83549e3ad2816a4ac1fd94de654b0590bf634dda Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 14 Dec 2025 12:52:50 +0100 Subject: [PATCH] buildGoModule: fix GOFLAGS for structuredAttrs --- pkgs/build-support/go/module.nix | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index 30542b1d16c6..ea266422c6d8 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -223,18 +223,19 @@ lib.extendMkDerivation { GOTOOLCHAIN = "local"; CGO_ENABLED = args.env.CGO_ENABLED or go.CGO_ENABLED; - }; - GOFLAGS = - GOFLAGS - ++ - lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) - "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS" - (lib.optional (!finalAttrs.proxyVendor) "-mod=vendor") - ++ - lib.warnIf (builtins.elem "-trimpath" GOFLAGS) - "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true" - (lib.optional (!finalAttrs.allowGoReference) "-trimpath"); + GOFLAGS = toString ( + GOFLAGS + ++ + lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) + "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS" + (lib.optional (!finalAttrs.proxyVendor) "-mod=vendor") + ++ + lib.warnIf (builtins.elem "-trimpath" GOFLAGS) + "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true" + (lib.optional (!finalAttrs.allowGoReference) "-trimpath") + ); + }; inherit enableParallelBuilding;