-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build failure: goModules using go workspaces with Go >= 1.22 #299096
Comments
I think possible solutions include
Things I noticed when testing w/ talosctl
|
If the number of affected packages is low, I'd say this could be a good solution, as it doesn't require changes to the builder. The size difference is interesting, I'd expect it to be smaller with |
Very strongly suggest doing this.
I'd expect that I think this could work but not sure offhand if it might break something as the current assumption is that env isn't passed through to the vendor derivation. diff --git a/pkgs/applications/networking/cluster/talosctl/default.nix b/pkgs/applications/networking/cluster/talosctl/default.nix
index ae3d300a9eb8..a8c326b288e2 100644
--- a/pkgs/applications/networking/cluster/talosctl/default.nix
+++ b/pkgs/applications/networking/cluster/talosctl/default.nix
@@ -15,7 +15,7 @@ buildGoModule rec {
ldflags = [ "-s" "-w" ];
- GOWORK = "off";
+ env.GOWORK = "off";
subPackages = [ "cmd/talosctl" ];
diff --git a/pkgs/build-support/go/module.nix b/pkgs/build-support/go/module.nix
index 153b675d48ae..2aa589f6082b 100644
--- a/pkgs/build-support/go/module.nix
+++ b/pkgs/build-support/go/module.nix
@@ -78,6 +78,7 @@ let
preBuild = args.preBuild or "";
postBuild = args.modPostBuild or "";
sourceRoot = args.sourceRoot or "";
+ env = args.env or null;
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND"
|
I can test this over the weekend, but can I ask why this is the preferred option? See also #291409 where it overrides the vendor command to |
I didn't take a look at the concrete example of |
Steps To Reproduce
Steps to reproduce the behavior:
nix build github:NixOS/nixpkgs?rev=c726225724e681b3626acc941c6f95d2b0602087#talosctl.goModules --rebuild
Build log
Additional context
Starting with Go 1.22,
go mod vendor
fails whengo.work
is present and workspace mode is not explicitly disabled withGOWORK=off
(upstream change). The affected packages already setGOWORK=off
, but this is not passed down when building the goModules dependency.As goModules is a fixed-output derivation, builds aren't failing in Hydra yet.
Affected packages (listed with a rudimentary
grep -rF GOWORK
and build confirmed to fail):Builds seem to succeed with Go 1.21, and
overrideModAttrs = _: { env.GOWORK = "off"; };
also fixed the build, tested on talosctl.Notify maintainers
Not sure who to ping, going with
pkgs/build-support/go
codeowners:@kalbasit @Mic92 @zowoq
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: