Skip to content

Commit

Permalink
Merge pull request #1570 from cachix/fix-go-builder-override
Browse files Browse the repository at this point in the history
go: use non-versioned `buildGoModule` to support out-of-band compilers
  • Loading branch information
domenkozar authored Nov 15, 2024
2 parents 87edaaf + f7ab477 commit acebfdd
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/modules/languages/go.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@
let
cfg = config.languages.go;

goVersion = (lib.versions.major cfg.package.version) + (lib.versions.minor cfg.package.version);

buildWithSpecificGo = pkg: pkg.override {
buildGoModule = pkgs."buildGo${goVersion}Module".override {
go = cfg.package;
};
};
# Override the buildGoModule function to use the specified Go package.
buildGoModule = pkgs.buildGoModule.override { go = cfg.package; };
buildWithSpecificGo = pkg: pkg.override { inherit buildGoModule; };
in
{
options.languages.go = {
Expand Down Expand Up @@ -45,7 +41,7 @@ in
(buildWithSpecificGo pkgs.gotests)
];

hardeningDisable = (lib.optional (cfg.enableHardeningWorkaround) "fortify");
hardeningDisable = lib.optional (cfg.enableHardeningWorkaround) "fortify";

env.GOROOT = cfg.package + "/share/go/";
env.GOPATH = config.env.DEVENV_STATE + "/go";
Expand Down

0 comments on commit acebfdd

Please sign in to comment.