From cb7d80dcaf926a38e80044c29a8210e69f27bb80 Mon Sep 17 00:00:00 2001 From: zowoq <59103226+zowoq@users.noreply.github.com> Date: Sun, 1 Aug 2021 08:00:39 +1000 Subject: [PATCH] buildGo{Module,Package}: warn if buildFlags is used --- pkgs/development/go-modules/generic/default.nix | 5 +++++ pkgs/development/go-packages/generic/default.nix | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix index 5ab5818a6c1f..a7852bcc7e5d 100644 --- a/pkgs/development/go-modules/generic/default.nix +++ b/pkgs/development/go-modules/generic/default.nix @@ -46,6 +46,9 @@ # Not needed with buildGoModule , goPackagePath ? "" +# needed for buildFlags warning +, buildFlags ? "" + , ... }@args': with builtins; @@ -268,4 +271,6 @@ let }; }); in +lib.warnIf (buildFlags != "") + "Use the `ldflags` and/or `tags` attributes instead of `buildFlags`" package diff --git a/pkgs/development/go-packages/generic/default.nix b/pkgs/development/go-packages/generic/default.nix index 6700dec082bc..6eaeee2a1230 100644 --- a/pkgs/development/go-packages/generic/default.nix +++ b/pkgs/development/go-packages/generic/default.nix @@ -43,6 +43,9 @@ , CGO_ENABLED ? go.CGO_ENABLED +# needed for buildFlags warning +, buildFlags ? "" + , meta ? {}, ... } @ args: @@ -257,4 +260,6 @@ let } // meta; }); in +lib.warnIf (buildFlags != "") + "Use the `ldflags` and/or `tags` attributes instead of `buildFlags`" package