buildGoApplication: warn if buildFlags is used

This is a port of cb7d80dcaf
This commit is contained in:
adisbladis 2022-06-14 19:01:44 +08:00
parent f42a0cddb4
commit 8aa44afb7e

View file

@ -181,6 +181,10 @@ let
, meta ? { } , meta ? { }
, passthru ? { } , passthru ? { }
, tags ? [ ] , tags ? [ ]
# needed for buildFlags warning
, buildFlags ? ""
, ... , ...
}@attrs: }@attrs:
let let
@ -217,7 +221,9 @@ let
inherit go modulesStruct localReplaceCommands defaultPackage; 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; pname = attrs.pname or baseNameOf defaultPackage;
version = stripVersion (modulesStruct.mod.${defaultPackage}).version; version = stripVersion (modulesStruct.mod.${defaultPackage}).version;