From 8aa44afb7e53a1fc5c9923a5ae5ab32bb7ee4b0f Mon Sep 17 00:00:00 2001 From: adisbladis Date: Tue, 14 Jun 2022 19:01:44 +0800 Subject: [PATCH] buildGoApplication: warn if buildFlags is used This is a port of https://github.com/NixOS/nixpkgs/commit/cb7d80dcaf926a38e80044c29a8210e69f27bb80 --- builder/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/builder/default.nix b/builder/default.nix index 7300482..657fd8f 100644 --- a/builder/default.nix +++ b/builder/default.nix @@ -181,6 +181,10 @@ let , meta ? { } , passthru ? { } , tags ? [ ] + + # needed for buildFlags warning + , buildFlags ? "" + , ... }@attrs: let @@ -217,7 +221,9 @@ let inherit go modulesStruct localReplaceCommands defaultPackage; }; - package = stdenv.mkDerivation (lib.optionalAttrs (defaultPackage != "") + package = lib.warnIf (buildFlags != "") + "Use the `ldflags` and/or `tags` attributes instead of `buildFlags`" + stdenv.mkDerivation (lib.optionalAttrs (defaultPackage != "") { pname = attrs.pname or baseNameOf defaultPackage; version = stripVersion (modulesStruct.mod.${defaultPackage}).version;