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: backport the new Go infrastructure to release 19.03 #57805

Merged
merged 3 commits into from Mar 18, 2019

Conversation

kalbasit
Copy link
Member

@kalbasit kalbasit commented Mar 17, 2019

Motivation for this change

This pull request backports #57080 into release 19.03. #57080 provides a new infrastructure for packaging Go modules without the need to manually package the dependencies. It relies instead on Go's module reproducibility and versioning to compute the dependencies in the early stage of the build.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

cc @NixOS/backports

This change moves buildGoPackage from pkgs/development/go-modules to
pkgs/development/go-packages, so we can have buildGoModule at
pkgs/development/go-modules.

(cherry picked from commit a0d835e)
The function buildGoModule builds Go programs managed with Go modules. It builds
a Go module through a two phase build:

- An intermediate fetcher derivation. This derivation will be used to
  fetch all of the dependencies of the Go module.
- A final derivation will use the output of the intermediate derivation
  to build the binaries and produce the final output.

(cherry picked from commit 28435e4)
@kalbasit
Copy link
Member Author

@GrahamcOfBorg build jx pet hugo gotools terminal-parrot todoist hetzner-kube mod

@kalbasit kalbasit requested a review from Mic92 March 17, 2019 16:40
@lheckemann
Copy link
Member

Why would we need to backport this? It's a breaking change that AFAIU doesn't fix any major functionality or security bugs.

@kalbasit
Copy link
Member Author

@lheckemann it's not a breaking change, but instead a new feature. It does make packaging Go modules a lot easier than it currently is. The legacy buildGoPackage remains unchanged.

@Mic92
Copy link
Member

Mic92 commented Mar 18, 2019

@kalbasit for the backport it might be better to skip migration of existing packages and only backport the function/documentation itself.

@kalbasit kalbasit force-pushed the nixpkgs_backport-build-go-module branch from a339da7 to a456b83 Compare March 18, 2019 16:03
@kalbasit
Copy link
Member Author

@Mic92 sure, I've rebased my pull request and left only commits directly related to buildGoModule.

@Mic92
Copy link
Member

Mic92 commented Mar 18, 2019

Thanks!

@kalbasit kalbasit deleted the nixpkgs_backport-build-go-module branch March 18, 2019 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants