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

buildGoPackage: support go modules #98903

Closed
wants to merge 1 commit into from
Closed

Conversation

yihuang
Copy link
Contributor

@yihuang yihuang commented Sep 27, 2020

set moduleDir to enable new behaviour, empty string for root module,
so it's backward compatible. When new behaviour enabled, it will:

  • omit submodules (subdirectoires which contains go.mod)
  • able to fetch specific submodules in a repo

make shellHook work with multiple major versions

Motivation for this change

To make vgo2nix work with go modules better, we find buildGoPackage need to handle some go modules rules:

  • omit submodules
  • fetch a specific submodule in a repo
  • change nix-shell to work with submodules or major versions.
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.

@yihuang
Copy link
Contributor Author

yihuang commented Sep 27, 2020

https://gist.github.com/yihuang/7e9e3cfb5ab3f126f077c1e5b66002ad
the test case that don't work before but works now.

  • support multiple major versions of same module
  • support different minor versions of different modules in same repo

set `moduleDir` to enable new behaviour, empty string for root module,
so it's backward compatible. When new behaviour enabled, it will:
- omit submodules (subdirectoires which contains go.mod)
- able to fetch specific submodules in a repo

make shellHook work with multiple major versions

Fix NixOS#98848
Fix NixOS#98604
@stale
Copy link

stale bot commented Jul 20, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 20, 2021
@yihuang
Copy link
Contributor Author

yihuang commented Jul 21, 2021

Closing this, since gomod2nix is better.

@yihuang yihuang closed this Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants