buildGoModule: fix GOFLAGS for structuredAttrs

This commit is contained in:
Stefan Frijters
2025-12-14 12:52:50 +01:00
parent f405a798c3
commit 83549e3ad2
+12 -11
View File
@@ -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;