buildGoModule: building Go binaries in two phases#57080
Merged
kalbasit merged 13 commits intoNixOS:masterfrom Mar 14, 2019
Merged
buildGoModule: building Go binaries in two phases#57080kalbasit merged 13 commits intoNixOS:masterfrom
kalbasit merged 13 commits intoNixOS:masterfrom
Conversation
53d9cdf to
53829fb
Compare
This comment has been minimized.
This comment has been minimized.
53829fb to
1f21995
Compare
7fc305e to
b3437e2
Compare
Member
Author
|
@GrahamcOfBorg build jx pet hugo gotools |
b3437e2 to
a1d010c
Compare
556fe3f to
6f89cdd
Compare
Member
Author
|
@GrahamcOfBorg build jx pet hugo gotools |
45beb9d to
174ba7e
Compare
48efa69 to
c717237
Compare
Mic92
reviewed
Mar 14, 2019
Mic92
reviewed
Mar 14, 2019
c717237 to
627b088
Compare
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.
af208c4 to
8f8e71c
Compare
Member
Author
|
@Mic92 I've addressed your comments. I have also conducted some tests to verify with certainty that the modules downloaded are not affected by changes to the upstream repository, such as with the release of a new verison. This PR is now clear to be merged as well. PTAL. |
Mic92
approved these changes
Mar 14, 2019
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation for this change
This change provides a new builder called
buildGoModulefor building Go packages with go modules support in mind. It does build through two phases:go mod downloadwill be executed within the source directory to download all of the dependencies, and store them at$GOPATH/pkg/mod. After removing the impure directory$GOPATH/pkg/mod/cache/vcs, we persist$GOPATH/pkg/modas the $out of this derivation.GOPROXYto point to the download directory within${go-modules}/cache/downloadwhich instructs Go to skip any network call, and simply use the already-downloaded dependencies.The benefit of such infrastructure is that we no longer need tools such as dep2nix or vgo2nix to parse the go.mod and go.sum in order to generate Nix dependency file.
Things done
sandboxinnix.confon non-NixOS)nix-shell -p nox --run "nox-review wip"./result/bin/)nix path-info -Sbefore and after)hugo.pet.jx.gotools.terminal-parrot.todoist.hetzner-kube.mod.cc @ehmry @lethalman @fpletz @Mic92 @nlewo