Skip to content
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

buildGoModule: copy vendor instead of symlinking #101374

Merged
merged 2 commits into from Nov 6, 2020
Merged

buildGoModule: copy vendor instead of symlinking #101374

merged 2 commits into from Nov 6, 2020

Conversation

@zowoq
Copy link
Contributor

@zowoq zowoq commented Oct 22, 2020

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
@zowoq zowoq requested review from kalbasit and Mic92 as code owners Oct 22, 2020
@zowoq zowoq marked this pull request as draft Oct 22, 2020
@zowoq zowoq marked this pull request as ready for review Oct 22, 2020
@zowoq zowoq changed the title buildGoModule: copy vendor instead of symlinking buildGo{Package,Module}: set trimpath in GOFLAGS, buildGoModule: copy vendor instead of symlinking Oct 27, 2020
@@ -126,7 +126,7 @@ let
inherit (go) GOOS GOARCH;

GO111MODULE = "on";
GOFLAGS = "-mod=vendor";
GOFLAGS = "-mod=vendor -trimpath";
Copy link
Member

@Mic92 Mic92 Oct 28, 2020

Does this make find $out/{bin,libexec,lib} -type f 2>/dev/null | xargs -r ${removeExpr removeReferences} || true obsolete or what paths does it remove?

Copy link
Contributor Author

@zowoq zowoq Oct 28, 2020

Yes, we should be able to drop removeReferences.

I started working on this on a different branch and thought I'd combine them to save a few rebuilds but I seem to have messed them up. I'll need to fix it and retest.

@@ -18,6 +18,11 @@ buildGoModule rec {
stdenv.lib.optionalString (!stdenv.hostPlatform.isWindows)
"${bash}/bin/bash";

# fix hardcoded GOFLAGS in makefile
postPatch = ''
substituteInPlace GNUmakefile --replace "export GOFLAGS=-mod=vendor" ""
Copy link
Contributor Author

@zowoq zowoq Oct 29, 2020

makefiles, etc that don't respect our GOFLAGS are a problem. I haven't checked everything yet but a lot of packages that override phases do respect our flags or they set trimpath themselves.

We could keep removeReferences anyway to avoid needing to do this type of fix?

Not that many packages override a *Phase, probably better to drop removeReferences.

zowoq added 2 commits Nov 1, 2020
Allow the second phase to modify the contents of the vendor directory.
@zowoq zowoq changed the title buildGo{Package,Module}: set trimpath in GOFLAGS, buildGoModule: copy vendor instead of symlinking buildGoModule: copy vendor instead of symlinking Nov 1, 2020
@zowoq
Copy link
Contributor Author

@zowoq zowoq commented Nov 1, 2020

We should have new versions of go in the next day or two. I'll merge the buildGoModule copy vendor commits with the version bumps and do trimpath in another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants