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: pre-initialize module cache #61967

Merged
merged 1 commit into from May 24, 2019
Merged

Conversation

johnchildren
Copy link
Contributor

@johnchildren johnchildren commented May 23, 2019

For some Go projects a go.mod file is included but there are no listed
dependencies. When this is encountered the Go toolchain will not create
a cache folder for downloaded dependencies which causes buildGoModule to
fail.

An example of a project like this that is widely used is:
https://github.com/golang/protobuf

This commit adds a mkdir command to ensure that the directory always
exists so it can be copied and prevent the failure.

An example of this before and after my patch:

https://github.com/johnchildren/nix-empty-go-modules/tree/master
https://github.com/johnchildren/nix-empty-go-modules/tree/fix-demonstration

Motivation for this change
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 nix-review --run "nix-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.

For some Go projects a go.mod file is included but there are no listed
dependencies. When this is encountered the Go toolchain will not create
a cache folder for downloaded dependencies which causes buildGoModule to
fail.

An example of a project like this that is widely used is:
https://github.com/golang/protobuf

This commit adds a mkdir command to ensure that the directory always
exists so it can be copied and prevent the failure.
@johnchildren johnchildren changed the title Adds configure step to initialize go cache buildGoModule: pre-initialize module cache May 23, 2019
@dywedir dywedir requested a review from kalbasit May 24, 2019 15:44
@kalbasit kalbasit self-assigned this May 24, 2019
@kalbasit
Copy link
Member

@GrahamcOfBorg build pet jx hugo proto-contrib amass termshark jump

@kalbasit kalbasit merged commit 8698c2a into NixOS:master May 24, 2019
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

2 participants