Merge pull request #278115 from katexochen/buildGoModule/trimpath

Changed files
+15 -14
pkgs
build-support
by-name
gc
gt
gtrash
up
uplosi
development
tools
language-servers
jq-lsp
tools
security
slsa-verifier
video
go2rtc
+8 -2
pkgs/build-support/go/module.nix
···
, ldflags ? [ ]
+
, GOFLAGS ? [ ]
+
# needed for buildFlags{,Array} warning
, buildFlags ? ""
, buildFlagsArray ? ""
···
inherit (go) GOOS GOARCH;
-
GOFLAGS = lib.optionals (!proxyVendor) [ "-mod=vendor" ] ++ lib.optionals (!allowGoReference) [ "-trimpath" ];
+
GOFLAGS = GOFLAGS
+
++ lib.optional (!proxyVendor) "-mod=vendor"
+
++ lib.optional (!allowGoReference) "-trimpath";
inherit CGO_ENABLED enableParallelBuilding GO111MODULE GOTOOLCHAIN;
# If not set to an explicit value, set the buildid empty for reproducibility.
-
ldflags = ldflags ++ lib.optionals (!lib.any (lib.hasPrefix "-buildid=") ldflags) [ "-buildid=" ];
+
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
configurePhase = args.configurePhase or (''
runHook preConfigure
···
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
"Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
lib.warnIf (builtins.elem "-buildid=" ldflags) "`-buildid=` is set by default as ldflag by buildGoModule"
+
lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
+
lib.warnIf (lib.any (lib.hasPrefix "-mod=") GOFLAGS) "use `proxyVendor` to control Go module/vendor behavior instead of setting `-mod=` in GOFLAGS"
package
+5 -2
pkgs/build-support/go/package.nix
···
, ldflags ? [ ]
+
, GOFLAGS ? [ ]
+
# needed for buildFlags{,Array} warning
, buildFlags ? ""
, buildFlagsArray ? ""
···
GO111MODULE = "off";
GOTOOLCHAIN = "local";
-
GOFLAGS = lib.optionals (!allowGoReference) [ "-trimpath" ];
+
GOFLAGS = GOFLAGS ++ lib.optional (!allowGoReference) "-trimpath" ;
GOARM = toString (lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
# If not set to an explicit value, set the buildid empty for reproducibility.
-
ldflags = ldflags ++ lib.optionals (!lib.any (lib.hasPrefix "-buildid=") ldflags) [ "-buildid=" ];
+
ldflags = ldflags ++ lib.optional (!lib.any (lib.hasPrefix "-buildid=") ldflags) "-buildid=";
configurePhase = args.configurePhase or (''
runHook preConfigure
···
lib.warnIf (buildFlags != "" || buildFlagsArray != "")
"Use the `ldflags` and/or `tags` attributes instead of `buildFlags`/`buildFlagsArray`"
lib.warnIf (builtins.elem "-buildid=" ldflags) "`-buildid=` is set by default as ldflag by buildGoModule"
+
lib.warnIf (builtins.elem "-trimpath" GOFLAGS) "`-trimpath` is added by default to GOFLAGS by buildGoModule when allowGoReference isn't set to true"
package
+1 -1
pkgs/by-name/gc/gcs/package.nix
···
];
# flags are based on https://github.com/richardwilkes/gcs/blob/master/build.sh
-
flags = [ "-a -trimpath" ];
+
flags = [ "-a" ];
ldflags = [ "-s" "-w" "-X github.com/richardwilkes/toolbox/cmdline.AppVersion=${version}" ];
installPhase = ''
-1
pkgs/by-name/gt/gtrash/package.nix
···
doCheck = false;
CGO_ENABLED = 0;
-
GOFLAGS = [ "-trimpath" ];
ldflags = [
"-s"
"-w"
-1
pkgs/by-name/up/uplosi/package.nix
···
CGO_ENABLED = "0";
ldflags = [ "-s" "-w" "-X main.version=${version}" ];
-
flags = [ "-trimpath" ];
nativeBuildInputs = [ installShellFiles ];
+1 -1
pkgs/development/tools/language-servers/jq-lsp/default.nix
···
# based on https://github.com/wader/jq-lsp/blob/master/.goreleaser.yml
CGO_ENABLED = 0;
-
GOFLAGS = [ "-trimpath" ];
+
ldflags = [
"-s"
"-w"
-2
pkgs/tools/security/slsa-verifier/default.nix
···
vendorHash = "sha256-rCGj2o59US2t/ckqXirEDgYn9dGvVSzMVcFEZosasBc=";
CGO_ENABLED = 0;
-
GO111MODULE = "on";
-
GOFLAGS = "-trimpath";
subPackages = [ "cli/slsa-verifier" ];
-4
pkgs/tools/video/go2rtc/default.nix
···
vendorHash = "sha256-KEW3ykEZvL6y1VacDIqtHW9B2RLHlHC29aqJjkEnRqQ=";
-
buildFlagArrays = [
-
"-trimpath"
-
];
-
CGO_ENABLED = 0;
ldflags = [