Skip to content
This repository has been archived by the owner on Feb 26, 2019. It is now read-only.

Git-ignoring the vendor/ directory #474

Closed
calvn opened this issue May 18, 2016 · 6 comments
Closed

Git-ignoring the vendor/ directory #474

calvn opened this issue May 18, 2016 · 6 comments

Comments

@calvn
Copy link

calvn commented May 18, 2016

I am not all too familiar with the inner-workings of dependency resolution for Go, so I wanted to know the reason behind the need to (git) include vendor/ in a Go project. If go restore would perform the vendoring before installing the packages in $GOPATH I think there would be no need to commit dependency sources into the project.

On npm, for instance, you would commit the package.json which has references (among other things) to all the dependencies that the package needs, but you don't commit node_pacakges which is what contains the source. npm install on the project would do the job of fetching all the dependencies. I was hoping for something similar on godep, which would make projects much lighter.

@freeformz
Copy link

When a repo is git pushed to remote that has no source, how will that remote build the source w/o hitting the network?

@freeformz
Copy link

If you are looking for that feature, please see govendor. PS: If you migrate to govendor, please don't use it's migrate command. I suggest instead doing:

$ godep restore
$ rm -rf Godeps vendor
$ govendor init
$ govendor add +ex

@calvn
Copy link
Author

calvn commented May 18, 2016

Your point is fair, but I think that git-ignoring vendor/ should be an option. godep restore should try to fetch remote dependencies if vendor/ is absent before showing failure due to network, if there is one. If vendor/ is already present, then simply skip that step. I think giving users the option is better than excluding it entirely.

Edit: I just dug deeper into this and saw #123 and #131 along with the proposal to remove such feature.

@freeformz
Copy link

@cleung2010 godep restore doesn't use the contents of vendor/ it's sole job is to fetch what is described in Godeps.json into $GOPATH.

@calvn
Copy link
Author

calvn commented May 18, 2016

I see. I was thinking maybe godep restore (or some alternate command) could do the fetching to vendor/. Anyhow, I think I've found glide, which has what I am looking for.

@freeformz
Copy link

@cleung2010 Great! FWIW: My recommendation would be govendor.

ghost pushed a commit to kamilpp/rpn_polyglot that referenced this issue Feb 20, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants