Skip to content

buildGoPackage: include goDeps in nix-shell GOPATH#16297

Closed
kamilchm wants to merge 1 commit intoNixOS:masterfrom
kamilchm:godeps-nix-shell
Closed

buildGoPackage: include goDeps in nix-shell GOPATH#16297
kamilchm wants to merge 1 commit intoNixOS:masterfrom
kamilchm:godeps-nix-shell

Conversation

@kamilchm
Copy link
Member

Motivation for this change

nix-shell should works as development environment for Go packages
see https://gist.github.com/qknight/ec772db7ab484296c64af008de628d9e

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • OS X
    • Linux
  • 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/)
  • Fits CONTRIBUTING.md.

@mention-bot
Copy link

By analyzing the blame information on this pull request, we identified @wkennington, @ehmry and @lethalman to be potential reviewers

@chris-martin
Copy link
Contributor

I'm looking at the difference between this as #15490 and I don't understand the change. I didn't need the shell hook to add the dependencies to the GOPATH when I tried this before. I suspect they end up on the path twice now?

@kamilchm
Copy link
Member Author

I tested you version and it didn't create any link to dependencies sources when used with current master. This one worked and build proper GOPATH with all needed sources for me.

@qknight
Copy link
Member

qknight commented Jun 19, 2016

i've been playing with this and for some dependencies it seems to work! if i want to use a lib which is not already listed in ../../libs.json in nixpkgs i don't see how to support that with this patch.

example1

i noticed this:

  • without having "include": "../../libs.json", in the deps.json, no error will appear, it just won't find any dependencies listed in deps.json later on. i would like to see an error here.

  • using "include": "../../libs.json",, in the deps.json, makes it find golang.org/x/net

  • using "include": "../../../libs.json", makes it fail with:

    error: opening file ‘/home/joachim/Desktop/projects/nixos/nixpkgs/pkgs/development/libs.json’: No such file or directory
    

example2

it seems to ignore some dependencies from deps.json file, which is located in the project directory.

[
  {
    "include": "../../libs.json",
    "packages": [
      "golang.org/x/net",
      "asdofoasidioasdfiogolang.org/x/net/webfoo"
    ]
  }
]

beucase there is never a failure for the above dependency asdofoasidioasdfiogolang.org/x/net/webfoo.

request

  • please show me how to use my own custom libs.json and deps.json extensions, which might be in the project directory where i run nix-shell from.
  • there should be an error message when a dependency listed in packages is not in the nixpkgs's global libs.json

@kamilchm
Copy link
Member Author

kamilchm commented Jun 29, 2016

@qknight I'm looking at nix code to see if I can generate and parse nix expressions easily from Go to replace JSON in go2nix, as it was mentioned few times as a better overall solution. I'll come back to nix-shell and Go package development after few more experiments, holding your request for now.

@mstone
Copy link
Contributor

mstone commented Aug 30, 2016

@kamilchm @chris-martin @qknight -- this change works well for me on a recent nixpkgs checkout and fixes a regression introduced by #16017.

Can we merge it, or is there additional required testing, documentation, or development work?

@Mic92
Copy link
Member

Mic92 commented Oct 3, 2016

This code is already included: https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/go-modules/generic/default.nix#L183

@Mic92 Mic92 closed this Oct 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants