buildGoModule: use proxyVendor instead of runVend

This commit is contained in:
zowoq 2021-12-31 22:41:54 +10:00
parent 1fe22e1978
commit 8a8c88de70
2 changed files with 8 additions and 8 deletions

View file

@ -12,8 +12,7 @@ The function `buildGoModule` builds Go programs managed with Go modules. It buil
In the following is an example expression using `buildGoModule`, the following arguments are of special significance to the function:
- `vendorSha256`: is the hash of the output of the intermediate fetcher derivation. `vendorSha256` can also take `null` as an input. When `null` is used as a value, rather than fetching the dependencies and vendoring them, we use the vendoring included within the source repo. If you'd like to not have to update this field on dependency changes, run `go mod vendor` in your source repo and set `vendorSha256 = null;`
- `runVend`: runs the vend command to generate the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build.
- `proxyVendor`: Fetches (go mod download) and proxies the vendor directory. This is useful if any dependency has case-insensitive conflicts which will produce platform dependant `vendorSha256` checksums.
- `proxyVendor`: Fetches (go mod download) and proxies the vendor directory. This is useful if your code depends on c code and go mod tidy does not include the needed sources to build or if any dependency has case-insensitive conflicts which will produce platform dependant `vendorSha256` checksums.
```nix
pet = buildGoModule rec {

View file

@ -26,12 +26,10 @@
, vendorSha256
# Whether to delete the vendor folder supplied with the source.
, deleteVendor ? false
# Whether to run the vend tool to regenerate the vendor directory.
# This is useful if any dependency contain C files.
, runVend ? false
# Whether to fetch (go mod download) and proxy the vendor directory.
# This is useful if any dependency has case-insensitive conflicts
# which will produce platform dependant `vendorSha256` checksums.
# This is useful if your code depends on c code and go mod tidy does not
# include the needed sources to build or if any dependency has case-insensitive
# conflicts which will produce platform dependant `vendorSha256` checksums.
, proxyVendor ? false
# We want parallel builds by default
@ -43,6 +41,9 @@
, meta ? {}
# disabled
, runVend ? false
# Not needed with buildGoModule
, goPackagePath ? ""
@ -54,7 +55,7 @@
with builtins;
assert (runVend == true && proxyVendor == true) -> throw "can't use `runVend` and `proxyVendor` together";
assert runVend != false -> throw "`runVend` has been replaced by `proxyVendor`";
assert goPackagePath != "" -> throw "`goPackagePath` is not needed with `buildGoModule`";