diff options
author | Doron Behar <doron.behar@gmail.com> | 2023-04-21 18:08:54 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-22 11:08:54 +1000 |
commit | a82c8611ce47491bd3f80e2219bfaab06d47ec2f (patch) | |
tree | 67d989bf32650253db340e1be849a71153fe18b5 /pkgs/build-support/go/module.nix | |
parent | e025c6f560d19c5c72bfcc770bb5e9d18295d0d4 (diff) | |
download | nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar.gz nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar.bz2 nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar.lz nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar.xz nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.tar.zst nixpkgs-a82c8611ce47491bd3f80e2219bfaab06d47ec2f.zip |
buildGoModule: don't inherit build hooks when building go-modules (#225349)
* buildGoModule: don't inherit postBuild hook when building go-modules This is a slight revert of 5ce647b8bf7aee0d3862006d94df7878c7fc03a6 (#212800). Inheriting these hooks in the `.go-modules` derivation can be confusing: One doesn't expect them to run when generating the fixed output modules derivation, but only on the main derivation. A `postBuild` hook that adds some files to $out will cause a very hard to debug issue[1]. This commit adds support for a dedicated `modPostBuild` hook that will be used only by the derivation building `.go-modules`. Additionally, `go.section.md` now explains these attributes behavior better. [1]: https://discourse.nixos.org/t/cant-update-a-go-package-getting-go-inconsistent-vendoring/27063/6 Co-authored-by: Sandro <sandro.jaeckel@gmail.com>
Diffstat (limited to 'pkgs/build-support/go/module.nix')
-rw-r--r-- | pkgs/build-support/go/module.nix | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index 045ce11fe01..2c5d1827cde 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -83,12 +83,16 @@ let inherit (args) src; inherit (go) GOOS GOARCH; + # The following inheritence behavior is not trivial to expect, and some may + # argue it's not ideal. Changing it may break vendor hashes in Nixpkgs and + # out in the wild. In anycase, it's documented in: + # doc/languages-frameworks/go.section.md prePatch = args.prePatch or ""; patches = args.patches or []; patchFlags = args.patchFlags or []; postPatch = args.postPatch or ""; preBuild = args.preBuild or ""; - postBuild = args.postBuild or ""; + postBuild = args.modPostBuild or ""; sourceRoot = args.sourceRoot or ""; GO111MODULE = "on"; |