about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYueh-Shun Li <shamrocklee@posteo.net>2024-04-18 15:13:01 +0000
committerYueh-Shun Li <shamrocklee@posteo.net>2024-04-18 15:14:43 +0000
commit8d861e611873e55330fc2ef39bbf8591af0aef34 (patch)
tree5ee7fc909b3ff218d518c236c421e4655e4c30f3
parent6500de413a71678ee741aee7dc7974774091bf18 (diff)
buildGoModule: place GOFLAGS-related warnings around GOFLAGS specification
Avoid "global" warnings that complicates fixed-point arguments support.
-rw-r--r--pkgs/build-support/go/module.nix10
1 files changed, 5 insertions, 5 deletions
diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix
index f3661d532b982..dce3ddb470909 100644
--- a/pkgs/build-support/go/module.nix
+++ b/pkgs/build-support/go/module.nix
@@ -163,8 +163,10 @@ let
     inherit (go) GOOS GOARCH;
 
     GOFLAGS = GOFLAGS
-      ++ lib.optional (!proxyVendor) "-mod=vendor"
-      ++ lib.optional (!allowGoReference) "-trimpath";
+      ++ lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
+        (lib.optional (!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 (!allowGoReference) "-trimpath");
     inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN;
 
     # If not set to an explicit value, set the buildid empty for reproducibility.
@@ -318,6 +320,4 @@ let
     } // meta;
   });
 in
-lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
-lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
-  package
+package