summary refs log tree commit diff
path: root/pkgs/development/go-modules
diff options
context:
space:
mode:
authorzowoq <59103226+zowoq@users.noreply.github.com>2021-07-31 14:57:54 +1000
committerzowoq <59103226+zowoq@users.noreply.github.com>2021-08-06 09:09:58 +1000
commitb60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2 (patch)
tree0d6140382130bc3eddc4bfd3e26e88a7da2427ee /pkgs/development/go-modules
parented6852a778fefd20ad667493f8d94b917ca76304 (diff)
downloadnixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar.gz
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar.bz2
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar.lz
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar.xz
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.tar.zst
nixpkgs-b60dde0c1eadd1e62a5e26adb4c4b6c4e03050d2.zip
buildGo{Module,Package}: add `tags` argument
Simpler method of setting tags rather than using some combination of buildFlags, buildFlagsArray, preBuild, etc

Using `lib.concatStringsSep ","` as space separated tags are deprecated in go.
Diffstat (limited to 'pkgs/development/go-modules')
-rw-r--r--pkgs/development/go-modules/generic/default.nix5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkgs/development/go-modules/generic/default.nix b/pkgs/development/go-modules/generic/default.nix
index 968664f81c7..58747d11a59 100644
--- a/pkgs/development/go-modules/generic/default.nix
+++ b/pkgs/development/go-modules/generic/default.nix
@@ -10,6 +10,9 @@
 # Go linker flags, passed to go via -ldflags
 , ldflags ? []
 
+# Go tags, passed to go via -tag
+, tags ? []
+
 # A function to override the go-modules derivation
 , overrideModAttrs ? (_oldAttrs : {})
 
@@ -156,7 +159,7 @@ let
         echo "$d" | grep -q "\(/_\|examples\|Godeps\|testdata\)" && return 0
         [ -n "$excludedPackages" ] && echo "$d" | grep -q "$excludedPackages" && return 0
         local OUT
-        if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
+        if ! OUT="$(go $cmd $buildFlags "''${buildFlagsArray[@]}" ''${tags:+-tags=${lib.concatStringsSep "," tags}} ''${ldflags:+-ldflags="$ldflags"} -v -p $NIX_BUILD_CORES $d 2>&1)"; then
           if ! echo "$OUT" | grep -qE '(no( buildable| non-test)?|build constraints exclude all) Go (source )?files'; then
             echo "$OUT" >&2
             return 1