From ba2b91866b7097c9f6aa6983387dce625ed8d24c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Fri, 13 Sep 2024 13:25:19 +0200 Subject: [PATCH 1/2] chore: typos and comment fixups in Go build-support function --- pkgs/build-support/go/module.nix | 42 ++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index ab8491da34cd4..f34390883a4ec 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -1,56 +1,62 @@ { go, cacert, git, lib, stdenv }: { name ? "${args'.pname}-${args'.version}" + # The source used to build the derivation. , src + # Native build inputs used for the derivation. , nativeBuildInputs ? [ ] , passthru ? { } , patches ? [ ] - # A function to override the goModules derivation + # A function to override the `goModules` derivation. , overrideModAttrs ? (_oldAttrs: { }) - # path to go.mod and go.sum directory + # Directory to the `go.mod` and `go.sum` relative to the `src`. , modRoot ? "./" - # vendorHash is the SRI hash of the vendored dependencies - # - # if vendorHash is null, then we won't fetch any dependencies and - # rely on the vendor folder within the source. + # The SRI hash of the vendored dependencies. + # If `vendorHash` is `nulL`, no dependencies are fetched and + # the build relies on the vendor folder within the source. , vendorHash ? throw ( if args'?vendorSha256 then "buildGoModule: Expect vendorHash instead of vendorSha256" else "buildGoModule: vendorHash is missing" ) + # Whether to delete the vendor folder supplied with the source. , deleteVendor ? false + # Whether to fetch (go mod download) and proxy 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 `vendorHash` checksums. , proxyVendor ? false - # We want parallel builds by default + # We want parallel builds by default. , enableParallelBuilding ? true # Do not enable this without good reason - # IE: programs coupled with the compiler + # IE: programs coupled with the compiler. , allowGoReference ? false + # Go env. variable to enable CGO. , CGO_ENABLED ? go.CGO_ENABLED + # Meta data for the final derivation. , meta ? { } - # Not needed with buildGoModule + # Not needed with `buildGoModule`. , goPackagePath ? "" + # Go linker flags. , ldflags ? [ ] - + # Go build flags. , GOFLAGS ? [ ] - # needed for buildFlags{,Array} warning -, buildFlags ? "" -, buildFlagsArray ? "" + # Needed for buildFlags{,Array} warning +, buildFlags ? "" # deprecated +, buildFlagsArray ? "" # deprecated , ... }@args': @@ -73,10 +79,10 @@ let inherit (go) GOOS GOARCH; inherit GO111MODULE GOTOOLCHAIN; - # The following inheritence behavior is not trivial to expect, and some may + # The following inheritance 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 + # doc/languages-frameworks/go.section.md. prePatch = args.prePatch or ""; patches = args.patches or [ ]; patchFlags = args.patchFlags or [ ]; @@ -151,8 +157,8 @@ let outputHashMode = "recursive"; outputHash = vendorHash; - # Handle empty vendorHash; avoid - # error: empty hash requires explicit hash algorithm + # Handle empty `vendorHash`; avoid error: + # empty hash requires explicit hash algorithm. outputHashAlgo = if vendorHash == "" then "sha256" else null; }).overrideAttrs overrideModAttrs; @@ -307,7 +313,7 @@ let passthru = passthru // { inherit go goModules vendorHash; }; meta = { - # Add default meta information + # Add default meta information. platforms = go.meta.platforms or lib.platforms.all; } // meta; }); From 9a6d7cc9f7870f37929e8baf8bd7cc3f42c834e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20N=C3=BCtzi?= Date: Fri, 11 Oct 2024 12:00:13 +0200 Subject: [PATCH 2/2] module.nix aktualisieren Co-authored-by: Wael Nasreddine --- pkgs/build-support/go/module.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix index f34390883a4ec..63299df4c3a8f 100644 --- a/pkgs/build-support/go/module.nix +++ b/pkgs/build-support/go/module.nix @@ -15,7 +15,7 @@ , modRoot ? "./" # The SRI hash of the vendored dependencies. - # If `vendorHash` is `nulL`, no dependencies are fetched and + # If `vendorHash` is `null`, no dependencies are fetched and # the build relies on the vendor folder within the source. , vendorHash ? throw ( if args'?vendorSha256 then